[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/attributeManager/includes/ -> attributeManagerPrompts.inc.php (source)

   1  <?php
   2  /*
   3    $Id: attributeManagerPrompts.inc.php,v 1.0 21/02/06 Sam West$
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Released under the GNU General Public License
   9    
  10    Copyright  2006 Kangaroo Partners
  11    http://kangaroopartners.com
  12    [email protected]
  13  */
  14  
  15  function yesNoButtons($section) {
  16  return '
  17  <div class="popupFooter">
  18              <input type="submit" value="'.AM_AJAX_YES.'" onClick="return '.$section.'();" class="amSubmitButton" />&nbsp;
  19              <input type="submit" value="'.AM_AJAX_NO.'" onClick="removeCustomPrompt();" class="amSubmitButton" />
  20  </div>';
  21  }
  22  
  23  function updateCancelButtons($section) {
  24  return '
  25  <div class="popupFooter">
  26      <input type="submit" value="'.AM_AJAX_UPDATE.'" onClick="return '.$section.'();" class="amSubmitButton" />&nbsp;
  27      <input type="submit" value="'.AM_AJAX_CANCEL.'" onClick="removeCustomPrompt();" class="amSubmitButton" />
  28  </div>';
  29  }
  30  
  31  function languageTextFields() {
  32  
  33  $return = '
  34  <table>';
  35      $languages = tep_get_languages();
  36      foreach ($languages as $amLanguage) {
  37  $return .='
  38      <tr>
  39          <td align="right">'. tep_image(DIR_WS_CATALOG_LANGUAGES . $amLanguage['directory'] . '/images/' . $amLanguage['image'], $amLanguage['name']).'</td>
  40          <td>'.tep_draw_input_field('text_field_'.$amLanguage['id'],'','id="'.$amLanguage['id'].'"').'</td>
  41      </tr>';
  42      }
  43  if ($_GET['section']== 'amAddOption') {
  44  $style = 'style="margin:3px 0px 3px 0px;" id="stockTracking_1" size="4"';
  45  $optionSortDrop = array('1', '2', '3', '4', '5', '6', '7', '8', '9');
  46  $return .= '    <tr>';
  47  if(AM_USE_SORT_ORDER) {
  48      $return .= '<td>'.AM_AJAX_SORT.tep_draw_pull_down_menu('optionSortDropDown', $optionSortDrop, '', 'id="optionSortDropDown"').'</td>';
  49  } else {
  50      $return .= tep_draw_hidden_field('optionSortDropDown', '0', 'id="optionSortDropDown"');
  51  }
  52  
  53  if(AM_USE_QT_PRO) {
  54      $return .='    <td>'.AM_AJAX_TRACK_STOCK.' <img src="attributeManager/images/icon_up.png" id="imgCheck_1" onclick="checkBox(1)" title="'.AM_AJAX_TRACK_STOCK_IMGALT.'" />
  55              '. tep_draw_hidden_field('stockTracking_1', '0', $style).'
  56              </td>';
  57  } else {
  58      $return .= tep_draw_hidden_field('stockTracking_1', '0', $style);
  59  }
  60  $return .='    </tr>';
  61  }
  62  $return .= '
  63  </table>';
  64  return $return;
  65  }
  66  
  67  
  68  function okButton() {
  69      return '<input type="submit" align="center" value="'.AM_AJAX_OK.'" onClick="removeCustomPrompt();" />';
  70  }
  71  
  72  class amPopups {
  73      var $header = '';
  74      var $contents = '';
  75      
  76  	function setHeader($string) {
  77          $this->header .= $string;
  78      }
  79      
  80  	function addToContents($string) {
  81          $this->contents .= $string;
  82      }
  83      
  84  	function output() {
  85          return '
  86          <div id="popupHeading">'.stripcslashes($this->header).'</div>
  87          <div id="popupContainer">'.$this->contents.'</div>';
  88      }
  89  }
  90  
  91  // check that it is a prompt section
  92  if(isset($_GET[AM_ACTION_GET_VARIABLE]) && $_GET[AM_ACTION_GET_VARIABLE] == 'prompt') {
  93      
  94      // de encode the extra gets string
  95      if(isset($_GET['gets'])) {
  96          $arrExtraValues = array();
  97          $valuePairs = array();
  98          
  99          if(strpos($_GET['gets'],'|')) 
 100              $valuePairs = explode('|',$_GET['gets']);
 101          else 
 102              $valuePairs[] = $_GET['gets'];
 103          
 104          foreach($valuePairs as $pair)
 105              if(strpos($pair,':')) {
 106                  list($extraKey, $extraValue) = explode(':',$pair);    
 107                  $arrExtraValues[$extraKey] = $extraValue;
 108              }
 109      }
 110      
 111      switch($_GET['section']) {
 112          case 'amAddOption':
 113              $amPopup = new amPopups();
 114              $amPopup->setHeader(AM_AJAX_ENTER_NEW_OPTION_NAME);
 115              $amPopup->addToContents(languageTextFields());
 116              $amPopup->addToContents(updateCancelButtons($_GET['section']));
 117              echo $amPopup->output();
 118              break;
 119          case 'amAddOptionValue':
 120              $amPopup = new amPopups();
 121              $amPopup->setHeader(AM_AJAX_ENTER_NEW_OPTION_VALUE_NAME);
 122              $amPopup->addToContents(languageTextFields());
 123              $amPopup->addToContents(updateCancelButtons($_GET['section']));
 124              echo $amPopup->output();
 125              break;
 126          case 'amAddNewOptionValueToProduct':
 127              $amPopup = new amPopups();
 128              $amPopup->setHeader(sprintf(AM_AJAX_ENTER_NEW_OPTION_VALUE_NAME_TO_ADD_TO, $arrExtraValues['option_name']));
 129              $amPopup->addToContents(languageTextFields());
 130              $amPopup->addToContents(updateCancelButtons($_GET['section']));
 131              $amPopup->addToContents(tep_draw_hidden_field('option_id',$arrExtraValues['option_id'],'id="option_id"'));
 132              echo $amPopup->output();
 133              break;
 134          case 'amRemoveOptionFromProduct': 
 135              $amPopup = new amPopups();
 136              $amPopup->setHeader(sprintf(AM_AJAX_PROMPT_REMOVE_OPTION_AND_ALL_VALUES, $arrExtraValues['option_name']));
 137              $amPopup->addToContents(yesNoButtons($_GET['section']));
 138              $amPopup->addToContents(tep_draw_hidden_field('option_id',$arrExtraValues['option_id'],'id="option_id"'));
 139              echo $amPopup->output();
 140              break;
 141          case 'amRemoveOptionValueFromProduct':
 142              $amPopup = new amPopups();
 143              $amPopup->setHeader(sprintf(AM_AJAX_PROMPT_REMOVE_OPTION, $arrExtraValues['option_value_name']));
 144              $amPopup->addToContents(yesNoButtons($_GET['section']));
 145              $amPopup->addToContents(tep_draw_hidden_field('option_id',$arrExtraValues['option_id'],'id="option_id"'));
 146              $amPopup->addToContents(tep_draw_hidden_field('option_value_id',$arrExtraValues['option_value_id'],'id="option_value_id"'));
 147              echo $amPopup->output();
 148              break;
 149  //----------------------------
 150  // Change: download attributes for AM
 151  //
 152  // author: mytool
 153  //-----------------------------
 154          case 'amAddNewDownloadForProduct':
 155              $amPopup = new amPopups();
 156              $amPopup->setHeader(sprintf(AM_AJAX_HEADER_DOWLNOAD_ADD_NEW , $arrExtraValues['option_value_name']));
 157              //$amPopup->addToContents(languageTextFields());
 158              $amPopup->addToContents('<DIV class="amFieldset">');
 159              $amPopup->addToContents('<div class="amFieldLabel">' .AM_AJAX_FILENAME.'</div><div class="amField">'. tep_draw_input_field('products_attributes_filename','','id="products_attributes_filename"') );
 160              // only for TinyMCE filemanager
 161  /*            $amPopup->addToContents('<a href="#" onClick="mcFileManager.open(document.forms[0].name,\'products_attributes_filename\',\'\',\'\',{document_base_url : \''.  DIR_WS_CATALOG . 'download/\',relative_urls:true,remove_script_host:true,rootpath:\''.DIR_FS_CATALOG.'download/\',remember_last_path:false});">' );
 162              $amPopup->addToContents( tep_image(DIR_WS_ADMIN. DIR_WS_INCLUDES . 'tiny_mce/themes/advanced/images/browse.gif', 'browse' ));
 163              $amPopup->addToContents('</a>');
 164  */            // EOF only for TinyMCE filemanager
 165              $amPopup->addToContents('</div>');
 166              $amPopup->addToContents('</DIV>');
 167              $amPopup->addToContents('<DIV class="amFieldset">');
 168              $amPopup->addToContents('<div class="amFieldLabel">' .AM_AJAX_FILE_DAYS.'</div><div class="amField">'. tep_draw_input_field('products_attributes_maxdays','7','id="products_attributes_maxdays"') . '</div>');
 169              $amPopup->addToContents('</DIV>');
 170              $amPopup->addToContents('<DIV class="amFieldset">');
 171              $amPopup->addToContents('<div class="amFieldLabel">' .AM_AJAX_FILE_COUNT.'</div><div class="amField">'. tep_draw_input_field('products_attributes_maxcount','5','id="products_attributes_maxcount"') . '</div>');
 172              //$amPopup->addToContents($_GET['section']);
 173              $amPopup->addToContents('</DIV>');
 174              $amPopup->addToContents(updateCancelButtons($_GET['section']));
 175              $amPopup->addToContents(tep_draw_hidden_field('option_id',$arrExtraValues['option_id'],'id="option_id"'));
 176              $amPopup->addToContents(tep_draw_hidden_field('products_attributes_id',$arrExtraValues['products_attributes_id'],'id="products_attributes_id"'));
 177              echo $amPopup->output();
 178              break;
 179          case 'amEditDownloadForProduct':
 180              $amPopup = new amPopups();
 181              $amPopup->setHeader(sprintf(AM_AJAX_HEADER_DOWLNOAD_EDIT , $arrExtraValues['option_value_name']));
 182              //$amPopup->addToContents(languageTextFields());
 183              $amPopup->addToContents('<DIV class="amFieldset">');
 184              $amPopup->addToContents('<div class="amFieldLabel">' .AM_AJAX_FILENAME.'</div><div class="amField">'.tep_draw_input_field('products_attributes_filename',$arrExtraValues['products_attributes_filename'],'id="products_attributes_filename"') );
 185              // only for TinyMCE filemanager
 186  /*            $amPopup->addToContents('<a href="#" onClick="mcFileManager.open(document.forms[0].name,\'products_attributes_filename\',\'\',\'\',{document_base_url : \''.  DIR_WS_CATALOG . 'download/\',relative_urls:true,remove_script_host:true,rootpath:\''.DIR_FS_CATALOG.'download/\',remember_last_path:false});">' );
 187              $amPopup->addToContents( tep_image(DIR_WS_ADMIN. DIR_WS_INCLUDES . 'tiny_mce/themes/advanced/images/browse.gif', 'browse' ));
 188              $amPopup->addToContents('</a>');
 189  */            // EOF only for TinyMCE filemanager
 190              $amPopup->addToContents('</div>');
 191              $amPopup->addToContents('</DIV>');
 192              $amPopup->addToContents('<DIV class="amFieldset">');
 193              $amPopup->addToContents('<div class="amFieldLabel">' .AM_AJAX_FILE_DAYS.'</div><div class="amField">' .tep_draw_input_field('products_attributes_maxdays',$arrExtraValues['products_attributes_maxdays'],'id="products_attributes_maxdays"') . '</div>');
 194              $amPopup->addToContents('</DIV>');
 195              $amPopup->addToContents('<DIV class="amFieldset">');
 196              $amPopup->addToContents('<div class="amFieldLabel">' .AM_AJAX_FILE_COUNT.'</div><div class="amField">' .tep_draw_input_field('products_attributes_maxcount',$arrExtraValues['products_attributes_maxcount'],'id="products_attributes_maxcount"') . '</div>');
 197              $amPopup->addToContents('</DIV>');
 198              //$amPopup->addToContents($_GET['section']);
 199              $amPopup->addToContents('</DIV>');
 200              $amPopup->addToContents(updateCancelButtons($_GET['section']));
 201              $amPopup->addToContents(tep_draw_hidden_field('option_id',$arrExtraValues['option_id'],'id="option_id"'));
 202              $amPopup->addToContents(tep_draw_hidden_field('products_attributes_id',$arrExtraValues['products_attributes_id'],'id="products_attributes_id"'));
 203              echo $amPopup->output();
 204              break;
 205          case 'amDeleteDownloadForProduct':
 206              $amPopup = new amPopups();
 207              $amPopup->setHeader(sprintf(AM_AJAX_HEADER_DOWLNOAD_DELETE, $arrExtraValues['option_value_name']));
 208              $amPopup->addToContents(yesNoButtons($_GET['section']));
 209              $amPopup->addToContents(tep_draw_hidden_field('option_id',$arrExtraValues['option_id'],'id="option_id"'));
 210              $amPopup->addToContents(tep_draw_hidden_field('products_attributes_id',$arrExtraValues['products_attributes_id'],'id="products_attributes_id"'));
 211              echo $amPopup->output();
 212              break;
 213  //----------------------------
 214  // EOF Change: download attributes for AM
 215  //-----------------------------
 216  
 217  // For QT Pro Plugin -- added by Phocea
 218          case 'amRemoveStockOptionValueFromProduct':
 219              $amPopup = new amPopups();
 220              $amPopup->setHeader(AM_AJAX_PROMPT_STOCK_COMBINATION);
 221              $amPopup->addToContents(yesNoButtons($_GET['section']));
 222              $amPopup->addToContents(tep_draw_hidden_field('option_id',$arrExtraValues['option_id'],'id="option_id"'));
 223              echo $amPopup->output();
 224              break;
 225  // For QT Pro Plugin -- added by Phocea
 226          case 'loadTemplate':
 227              $amPopup = new amPopups();
 228              $amPopup->setHeader(sprintf(AM_AJAX_PROMPT_LOAD_TEMPLATE, $arrExtraValues['template_name']));
 229              $amPopup->addToContents(yesNoButtons($_GET['section']));
 230              $amPopup->addToContents(tep_draw_hidden_field('template_id',$arrExtraValues['template_id'],'id="template_id"'));
 231              echo $amPopup->output();
 232              break;
 233          case 'saveTemplate':
 234              $amPopup = new amPopups();
 235              $amPopup->setHeader(AM_AJAX_NEW_TEMPLATE_NAME_HEADER);
 236              $amPopup->addToContents(AM_AJAX_NEW_NAME.'&nbsp'.tep_draw_input_field('template_name','','id="template_name" onchange="((this.value != \'\') ? document.getElementById(\'existing_template\').selectedIndex = 0 : \'\')"'));
 237              $templatesDrop = $attributeManager->buildAllTemplatesDropDown();
 238              $amPopup->setHeader(AM_AJAX_CHOOSE_EXISTING_TEMPLATE_TO_OVERWRITE);
 239              $amPopup->addToContents('<br /><br />'. AM_AJAX_CHOOSE_EXISTING_TEMPLATE_TITLE .'&nbsp'.  tep_draw_pull_down_menu('existing_template',$templatesDrop,'0','id="existing_template" onChange="document.getElementById(\'template_name\').value=\'\';"'));
 240              $amPopup->addToContents(updateCancelButtons($_GET['section']));
 241              $amPopup->addToContents(tep_draw_hidden_field('template_id',$arrExtraValues['template_id'],'id="template_id"'));
 242              echo $amPopup->output();
 243              break;
 244          case 'renameTemplate':
 245              $amPopup = new amPopups();
 246              $amPopup->setHeader(sprintf(AM_AJAX_RENAME_TEMPLATE_ENTER_NEW_NAME, $arrExtraValues['template_name']));
 247              $amPopup->addToContents(AM_AJAX_NEW_NAME.'&nbsp'.tep_draw_input_field('template_new_name','','id="template_new_name"'));
 248              $amPopup->addToContents(updateCancelButtons($_GET['section']));
 249              $amPopup->addToContents(tep_draw_hidden_field('template_id',$arrExtraValues['template_id'],'id="template_id"'));
 250              echo $amPopup->output();
 251              break;
 252          case 'deleteTemplate':
 253              $amPopup = new amPopups();
 254              $amPopup->setHeader(sprintf(AM_AJAX_PROMPT_DELETE_TEMPLATE, $arrExtraValues['template_name']));
 255              $amPopup->addToContents(yesNoButtons($_GET['section']));
 256              $amPopup->addToContents(tep_draw_hidden_field('template_id',$arrExtraValues['template_id'],'id="template_id"'));
 257              echo $amPopup->output();
 258              break;
 259          case 'debug':
 260              $amPopup = new amPopups();
 261              $amPopup->setHeader(implode($valuePairs, ','));
 262              $amPopup->addToContents(yesNoButtons($_GET['section']));
 263              $amPopup->addToContents(tep_draw_hidden_field('debug',$arrExtraValues['debug'],'id="debug"'));
 264              echo $amPopup->output();
 265              break;        
 266      }
 267      
 268      
 269      
 270  }
 271  
 272  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7