osCommerce France : Accueil Forum Portail osCommerce France Réponses aux questions Foire aux contributions

Bienvenue invité ( Connexion | Inscription )

 
Reply to this topicStart new topic
> [resolu]Formulaire ds un popup, et enregistrement sur la page "mere"
Frankouné
posté 5 Sep 2005, 17:23
Message #1


Ceinture orange OSC
Icône de groupe

Groupe : Membres
Messages : 251
Inscrit : 24-October 04
Membre no 3570



bonjour

je suis en train de modifier la page "configuration.php" de l'admin.
je voudrais afficher la page configuration.php, comprenant des données. En cliquant sur un bouton "editer", un popup s'ouvre, permettant de modifier une des données.

le probleme c comment envoyer les modification a la page configuration.php et fermer le popup en cliquand sur "enregister les modif" ?

merci smile.gif


--------------------
ms2fr / CRELoaded OSC 6.0 SP1.3
Concepteur de OSCREACTOR ( fork de creload)
Exploitation en localhost par XAMPP:
-- phpMyAdmin SQL Dump, version 2.6.1-pl3
-- Version de PHP: 5.0.4
Go to the top of the page
 
Frankouné
posté 6 Sep 2005, 14:47
Message #2


Ceinture orange OSC
Icône de groupe

Groupe : Membres
Messages : 251
Inscrit : 24-October 04
Membre no 3570



merci

finalement, j'ai reussi a bidouiller ( c le cas de le dire!) admin/categories.php, dons voici le code, si ça interesse qlq'un ........... :
(ce code peut generé des erreurs, vu qu'il fut crée pour une version deviée de creload: oscreactor)

CODE
<?php
/*
 $Id: configuration.php,v 1.2 2003/09/24 13:57:05 wilt Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

Header("Cache-control: private, no-cache");  
Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); # Past date
Header("Pragma: no-cache");

 require('includes/application_top.php');

 // #CP - local dir to the template directory where you are uploading the company logo
 $template_query = tep_db_query("select configuration_id, configuration_title, configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'DEFAULT_TEMPLATE'");
 $template = tep_db_fetch_array($template_query);
 $CURR_TEMPLATE = $template['configuration_value'] . '/';
 
 $upload_fs_dir = DIR_FS_TEMPLATES.$CURR_TEMPLATE.DIR_WS_IMAGES;
 $upload_ws_dir = DIR_WS_TEMPLATES.$CURR_TEMPLATE.DIR_WS_IMAGES;
 // #CP

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 if (tep_not_null($action)) {
   switch ($action) {
     case 'save':

       tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($configuration_value) . "', last_modified = now() where configuration_id = '" . (int)$cID . "'");

       tep_redirect(tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cID));
       break;
// #CP - supporting functions to upload company logo to template images directory      
     case 'processuploads':
     
       if (isset($GLOBALS['file_name']) && tep_not_null($GLOBALS['file_name'])) {
       
         $up_load = new upload('file_name', $upload_fs_dir);
         $file_name = $up_load->filename;
         
         if($file_name != "logo.gif"){
         unlink($upload_fs_dir."logo.gif");
         rename($upload_fs_dir.$file_name, $upload_fs_dir."logo.gif");
         }
       }

       tep_redirect(tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID']));
       break;
     case 'upload':
       $directory_writeable = true;
       if (!is_writeable($upload_fs_dir)) {
         $directory_writeable = false;
         $messageStack->add(sprintf(ERROR_DIRECTORY_NOT_WRITEABLE, $upload_fs_dir), 'error');
       }
       break;
   }
// #CP    
 }

 $gID = (isset($HTTP_GET_VARS['gID'])) ? $HTTP_GET_VARS['gID'] : 1;

 $cfg_group_query = tep_db_query("select configuration_group_title from " . TABLE_CONFIGURATION_GROUP . " where configuration_group_id = '" . (int)$gID . "'");
 $cfg_group = tep_db_fetch_array($cfg_group_query);
 
// check if the template image directory exists
 if (is_dir($upload_fs_dir)) {
   if (!is_writeable($upload_fs_dir)) $messageStack->add(ERROR_TEMPLATE_IMAGE_DIRECTORY_NOT_WRITEABLE . $upload_fs_dir, 'error');
 } else {
   $messageStack->add(ERROR_TEMPLATE_IMAGE_DIRECTORY_DOES_NOT_EXIST . $upload_fs_dir, 'error');
 }
 

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript" src="includes/general.js"></script>

<?php
 $heading = array();
 $contents = array();
 $configuration_query = tep_db_query("select configuration_id, configuration_title, configuration_value, last_modified, configuration_description, use_function from " . TABLE_CONFIGURATION . " where configuration_group_id = '" . (int)$gID . "' order by sort_order");
 while ($configuration = tep_db_fetch_array($configuration_query)) {


   if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $configuration['configuration_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
     $cfg_extra_query = tep_db_query("select configuration_key, configuration_description, date_added, last_modified, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_id = '" . (int)$configuration['configuration_id'] . "'");
     $cfg_extra = tep_db_fetch_array($cfg_extra_query);

     $cInfo_array = array_merge($configuration, $cfg_extra);
     $cInfo = new objectInfo($cInfo_array);
   }
}
 switch ($action) {
   case 'edit':

echo "</head><script type=\"text/javascript\" language=\"javascript\">
function lien(url) {
var maitre;
if (opener.closed) {maitre=window.open('','nomprincipal','toolbar=yes, location=yes,status=yes,menubar=yes, scrollbars=yes,resizable=yes,copyhistory=no');
maitre.location.href = url;
} else {opener.location.href = url;}
nomdupop=window.close()}
</script></head><body>";
if($configuration_value!='') {
echo "<script type='text/javascript' language='javascript'>
lien('". $PHP_SELF . "?configuration_value=" .$configuration_value."&gID=".$gID."&cID=".$cID."&action=save');</script>";
}else{


     $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');

     if ($cInfo->set_function) {
       eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");');
     } else {
       $value_field = tep_draw_input_field('configuration_value', $cInfo->configuration_value);
     }

     $contents = array('form' => tep_draw_form('configuration', FILENAME_CONFIGURATION, 'gID='.$gID.'&cID='.$cID.'&action=edit'));
     $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
     $contents[] = array('text' => '<br><b>' . $cInfo->configuration_title . '</b><br>' . $cInfo->configuration_description . '<br>' . $value_field);
     $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="javascript:window.close()">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');

}

     break;
   case 'upload':

echo "</head><script type=\"text/javascript\" language=\"javascript\">
function lien(url) {
var maitre;
if (opener.closed) {maitre=window.open('','nomprincipal','');
maitre.location.href = url;
} else {opener.location.href = url;}
nomdupop=window.close()}
</script></head><body>";
if($configuration_value!='') {
echo "<script type='text/javascript' language='javascript'>
lien('". $PHP_SELF . "?file_upload=" .$file_upload."&gID=".$gID."&cID=".$cID."&action=processuploads');</script>";
}else{

     $directory_writeable = true;
     if (!is_writeable($upload_fs_dir)) {
       $directory_writeable = false;
       $messageStack->add(sprintf(ERROR_DIRECTORY_NOT_WRITEABLE, $upload_fs_dir), 'error');
     }
     
     $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');

     $contents = array('form' => tep_draw_form('file', FILENAME_CONFIGURATION, 'gID='.$gID.'&cID='.$cID.'&action=upload'));
     $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
     $file_upload = tep_draw_file_field('file_name') . '<br>';
     $contents[] = array('text' => '<br>' . $file_upload);
     $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="javascript:window.close()">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
}


     break;


   default:

?>

</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?   require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo $cfg_group['configuration_group_title']; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr class="dataTableHeadingRow">
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_TITLE; ?></td>
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_VALUE; ?></td>
               <td class="dataTableHeadingContent"><?php echo TEXT_INFO_LAST_MODIFIED; ?></td>
               <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
             </tr>
<?
 $configuration_query = tep_db_query("select configuration_id, configuration_title, configuration_value, last_modified, configuration_description, use_function from " . TABLE_CONFIGURATION . " where configuration_group_id = '" . $gID . "' order by sort_order");
 while ($configuration = tep_db_fetch_array($configuration_query)) {


   if (tep_not_null($configuration['use_function'])) {
     $use_function = $configuration['use_function'];
     if (ereg('->', $use_function)) {
       $class_method = explode('->', $use_function);
       if (!is_object(${$class_method[0]})) {
         include(DIR_WS_CLASSES . $class_method[0] . '.php');
         ${$class_method[0]} = new $class_method[0]();
       }
       $cfgValue = tep_call_function($class_method[1], $configuration['configuration_value'], ${$class_method[0]});
     } else {
       $cfgValue = tep_call_function($use_function, $configuration['configuration_value']);
     }
   } else {
     $cfgValue = $configuration['configuration_value'];
   }

   if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $configuration['configuration_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
     $cfg_extra_query = tep_db_query("select configuration_key, configuration_description, date_added, last_modified, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_id = '" . (int)$configuration['configuration_id'] . "'");
     $cfg_extra = tep_db_fetch_array($cfg_extra_query);

     $cInfo_array = array_merge($configuration, $cfg_extra);
     $cInfo = new objectInfo($cInfo_array);
   }


    if($cInfo->set_function == 'file_upload'){
     echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="window.open(\'' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $gID . '&cID=' . $configuration['configuration_id']. '&action=upload') . '\', \'\',  \'height=200, width=300, top=100, left=100, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=yes, status=no \'  )">' . "\n";
     } else {
     echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="window.open(\'' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $gID . '&cID=' . $configuration['configuration_id']. '&action=edit') . '\', \'\',  \'height=200, width=300, top=100, left=100, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=yes, status=no \'  )">' . "\n";
     }


?>
               <td class="dataTableContent"><?php echo $configuration['configuration_title']; ?></td>
               <td class="dataTableContent"><?php echo htmlspecialchars($cfgValue); ?></td>
               <td class="dataTableContent"><?php echo $configuration['last_modified']; ?></td>
               <td class="dataTableContent" align="center"><a href="#" onMouseOver="return overlib('<? echo $configuration['configuration_description'] ?>', BELOW, RIGHT);" onmouseout="return nd();" ><img src="includes/javascript/tooltip.png" border="0" /></a></td>
             </tr>
<?php
 }
?>
           </table>
</td>
         </tr>
       </table></td>
     </tr>
   </table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>

<?
     break;
 }
 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {

   $box = new box;
   echo $box->infoBox($heading, $contents);
 }
?>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


--------------------
ms2fr / CRELoaded OSC 6.0 SP1.3
Concepteur de OSCREACTOR ( fork de creload)
Exploitation en localhost par XAMPP:
-- phpMyAdmin SQL Dump, version 2.6.1-pl3
-- Version de PHP: 5.0.4
Go to the top of the page
 

Reply to this topicStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :

 



RSS Version bas débit Nous sommes le : 28th March 2024 - 20:10
Ce site est déclaré auprès de la commision Nationale
de l'Informatique et des Libertés (déclaration n°: 1043896)