Extending Filemanager / Properties popup
Permalink
Hi all,
I have an request from a client to get download statistics for specific files based on a period of time.
So I thought I'll add a further tab to the Properties popup of the file manager. THAT part was easy. But when I try to submit my a form I get the popup reloaded without styles and js. What am I missing here? Please point me to the right direction... ;)
I have added a new tab "Download Count" which has two datepicker (from, to) and a submit button. I would like to query the database with the selected dates and display the number of downloads in the selected period. Preferably with ajax (not a must, would be ok if I manage to reload the properties tab without breaking it), but I only get it without all the headers and HTML header...
so the current implementation reloads the properties.php with a task name 'changeDownloadPeriod' (I got this from other updates in different tabs of the page).
So now I get this php code executed and displayed, which gets me the desired numbers, but not the usability I would like to have...
Changed files attached...
Best regards,
Markus
I have an request from a client to get download statistics for specific files based on a period of time.
So I thought I'll add a further tab to the Properties popup of the file manager. THAT part was easy. But when I try to submit my a form I get the popup reloaded without styles and js. What am I missing here? Please point me to the right direction... ;)
I have added a new tab "Download Count" which has two datepicker (from, to) and a submit button. I would like to query the database with the selected dates and display the number of downloads in the selected period. Preferably with ajax (not a must, would be ok if I manage to reload the properties tab without breaking it), but I only get it without all the headers and HTML header...
<!-- CUSTOM CODE HERE --> <div class="ccm-file-properties-details-tab" id="ccm-file-properties-downloadcount-<?php echo $f->getFileID()?>-<?php echo $fv->getFileVersionID()?>-tab" style="display: none"> <h1><?php echo t('Download Count')?></h1> <?php $dtt = Loader::helper('form/date_time'); $from = '01/01/2011'; $to = date('m/d/Y'); // convert to yyyy-mm-dd fro mySQL $from = substr($from, 6, 4).'-'.substr($from, 0, 2).'-'.substr($from, 3, 2); $to = substr($to, 6, 4).'-'.substr($to, 0, 2).'-'.substr($to, 3, 2); $dlCount = $f->getDownloadCount($from, $to); echo 'The file has been downloaded '.$dlCount.' times in total.<br><br>'; echo '<form method="post" action="' . REL_DIR_FILES_TOOLS_REQUIRED . '/files/properties"> <input type="submit" name="Submit" value="Submit" /> <input type="hidden" name="attributeField" value="' . $field . '" />
Viewing 15 lines of 23 lines. View entire code block.
so the current implementation reloads the properties.php with a task name 'changeDownloadPeriod' (I got this from other updates in different tabs of the page).
So now I get this php code executed and displayed, which gets me the desired numbers, but not the usability I would like to have...
if ($_POST['task'] == 'changeDownloadPeriod') { // some stupid converting needed to get the German dates (dd.mm.yyyy) converted to // something mySql can use in the query of the timestamps (yyyy-mm-dd). $from = substr($_POST['from'], 6, 4).'-'.substr($_POST['from'], 3, 2).'-'.substr($_POST['from'], 0, 2); $to = substr($_POST['to'], 6, 4).'-'.substr($_POST['to'], 3, 2).'-'.substr($_POST['to'], 0, 2); $dlCount = $f->getDownloadCount($from, $to); echo '<br><br>The file has been downloaded '.$dlCount.' times in the selected period ('.$_POST['from'].'-'.$_POST['to'].').'; exit; }
Changed files attached...
Best regards,
Markus