function getAudio($name, $local = false) { global $rsgConfig; $locale = $local ? JPATH_ROOT : JURI_SITE; // if thumb image exists return that, otherwise the original image width <= $thumb_width so we return the original image instead. if (file_exists(JPATH_ROOT . $rsgConfig->get('imgPath_original') . '/' . audioUtils::getAudioName($name))) { return $locale . $rsgConfig->get('imgPath_original') . '/' . audioUtils::getAudioName($name); } else { return; } }
function determineHandle($filename) { require_once JPATH_RSGALLERY2_ADMIN . '/includes/audio.utils.php'; require_once JPATH_RSGALLERY2_ADMIN . '/includes/video.utils.php'; $ext = strtolower(JFile::getExt($filename)); if (in_array($ext, imgUtils::allowedFileTypes())) { return 'imgUtils'; } else { if (in_array($ext, videoUtils::allowedFileTypes())) { return 'videoUtils'; } else { if (in_array($ext, audioUtils::allowedFileTypes())) { return 'audioUtils'; } else { return false; } } } }
/** * Writes the edit form for new and existing record * * A new record is defined when <var>$row</var> is passed with the <var>id</var> * property set to 0. * @param mosWeblink The weblink object * @param array An array of select lists * @param object Parameters * @param string The option */ function editImage(&$row, &$lists, &$params, $option) { global $rsgOption; jimport("joomla.filter.output"); JFilterOutput::objectHTMLSafe($row, ENT_QUOTES); JHTML::_('behavior.formvalidation'); $editor =& JFactory::getEditor(); ?> <script type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } // do field validation if (form.title.value == ""){ alert( "<?php echo JText::_('PLEASE PROVIDE A VALID IMAGE TITLE'); ?> " ); } else if (form.gallery_id.value <= "0"){ alert( "<?php echo JText::_('YOU MUST SELECT A GALLERY.'); ?> " ); } else { <?php echo $editor->save('descr'); ?> submitform( pressbutton ); } } </script> <form action="index2.php" method="post" name="adminForm" id="adminForm" class="form-validate" > <table class="adminheading"> <tr> <th><?php echo JText::_('Item'); ?> :<small><?php echo $row->id ? JText::_('Edit') : JText::_('New'); ?> </small></th> </tr> </table> <table width="100%"> <tr> <td width="60%" valign="top"> <table class="adminform"> <tr> <th colspan="2"><?php echo JText::_('Details'); ?> </th> </tr> <tr> <td width="20%" align="right"><?php echo JText::_('Name'); ?> </td> <td width="80%"> <input class="text_area required" type="text" name="title" size="50" maxlength="250" value="<?php echo $row->title; ?> " /> </td> </tr> <tr> <td width="20%" align="right"><?php echo JText::_('COM_RSGALLERY2_ALIAS'); ?> </td> <td width="80%"> <input class="text_area" type="text" name="alias" size="50" maxlength="250" value="<?php echo $row->alias; ?> " /> </td> </tr> <tr> <td width="20%" align="right"><?php echo JText::_('Filename'); ?> </td> <td width="80%"><?php echo $row->name; ?> </td> </tr> <tr> <td valign="top" align="right"><?php echo JText::_('Gallery'); ?> </td> <td><?php echo $lists['gallery_id']; ?> </td> </tr> <tr> <td valign="top" align="right"><?php echo JText::_('Description'); ?> </td> <td> <?php // parameters : areaname, content, hidden field, width, height, rows, cols echo $editor->display('descr', $row->descr, '100%', '200', '10', '20', false); ?> </td> </tr> <tr> <td valign="top" align="right"><?php echo JText::_('Ordering'); ?> </td> <td><?php echo $lists['ordering']; ?> </td> </tr> <tr> <td valign="top" align="right"><?php echo JText::_('Published'); ?> </td> <td><?php echo $lists['published']; ?> </td> </tr> </table> </td> <td width="40%" valign="top"> <table class="adminform"> <tr> <th colspan="1"><?php echo JText::_('Item preview'); ?> </th> </tr> <tr> <td> <div align="center"> <?php $item = rsgGalleryManager::getItem($row->id); $original = $item->original(); $thumb = $item->thumb(); switch ($item->type) { case "audio": ?> <object type="application/x-shockwave-flash" width="400" height="15" data="<?php echo JURI_SITE; ?> /components/com_rsgallery2/flash/xspf/xspf_player_slim.swf?song_title=<?php echo $row->name; ?> &song_url=<?php echo audioUtils::getAudio($row->name); ?> "><param name="movie" value="<?php echo JURI_SITE; ?> /components/com_rsgallery2/flash/xspf/xspf_player_slim.swf?song_title=<?php echo $item->title; ?> &song_url=<?php echo $original->url(); ?> " /></object> <?php break; case "video": // OS flv player from http://www.osflv.com ?> <object type="application/x-shockwave-flash" width="400" height="300" data="<?php echo JURI_SITE; ?> /components/com_rsgallery2/flash/player.swf?movie=<?php echo $display->name; ?> " > <param name="movie" value="<?php echo JURI_SITE; ?> /components/com_rsgallery2/flash/player.swf?movie=<?php echo $display->name; ?> " /> <embed src="<?php echo JURI_SITE; ?> /components/com_rsgallery2/flash/player.swf?movie=<?php echo $display->url(); ?> " width="400" height="340" allowFullScreen="false" type="application/x-shockwave-flash"> </object> <?php break; case "image": $display = $item->display(); ?> <img src="<?php echo $display->url(); ?> " alt="<?php echo htmlspecialchars(stripslashes($item->descr), ENT_QUOTES); ?> " /> <?php break; default: ?> Unsuported item <?php break; } ?> <br /> </div> </td> </tr> </table> <table class="adminform"> <tr> <th colspan="1"><?php echo JText::_('Parameters'); ?> </th> </tr> <tr> <td><?php echo $params->render(); ?> </td> </tr> </table> <table class="adminform"> <tr> <th colspan="1"><?php echo JText::_('Links to image'); ?> </th> </tr> <tr> <td> <table width="100%" class="imagelist"> <?php if ($item->type == 'image' || $item->type == "video") { ?> <tr> <td width="40%" align="right" valign="top"> <a href="<?php echo $thumb->url(); ?> " target="_blank" alt="<?php echo $item->name; ?> "><?php echo JText::_('Thumb'); ?> </a>:</td> <td><input type="text" name="thumb_url" class="text_area" size="50" value="<?php echo $thumb->url(); ?> " /></td> </tr> <tr> <td width="40%" align="right" valign="top"><a href="<?php echo $display->url(); ?> " target="_blank" alt="<?php echo $item->name; ?> "><?php echo JText::_('Display'); ?> </a>:</td> <td ><input type="text" name="display_url" class="text_area" size="50" value="<?php echo $display->url(); ?> " /></td> </tr> <?php } ?> <tr> <td width="40%" align="right" valign="top"><a href="<?php echo $original->url(); ?> " target="_blank" alt="<?php echo $item->name; ?> "><?php echo JText::_('Original'); ?> </a>:</td> <td><input type="text" name="original_url" class="text_area" size="50" value="<?php echo $original->url(); ?> " /></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <input type="hidden" name="id" value="<?php echo $row->id; ?> " /> <input type="hidden" name="name" value="<?php echo $row->name; ?> " /> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="rsgOption" value="<?php echo $rsgOption; ?> " /> <input type="hidden" name="task" value="" /> </form> <?php }