*** empty log message ***

This commit is contained in:
sebastian 2005-02-11 19:25:29 +00:00
parent 8da5b6a202
commit 534be5b5ff
13 changed files with 216 additions and 162 deletions

View File

@ -23,7 +23,7 @@
Author : $Author: sebastian $
Version : $Revision: 1.7 $
Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/conf.php,v $
------------------------------------------------------------------------------*/
@ -123,4 +123,6 @@ define('UI_QFORM_ERROR', 'templates/form_parts/error.tpl');
define('UI_SEARCH_MAX_ROWS', 8);
define('UI_SEARCH_MIN_ROWS', 2);
define('UI_REGEX_URL', '/^(ht|f)tps?:\/\/[^ ]+$/');
define('UI_SCRATCHPAD_KEY', 'djBagContents');
define('UI_SCRATCHPAD_REGEX', '/^([0-9a-f]{16}:[0-9]{4}-[0-9]{2}-[0-9]{2}( )?)+$/');
?>

View File

@ -18,7 +18,7 @@
{else}
{str_repeat str='&nbsp;' count=3} <span id="ID{$o.id}">
{/if}
<a {if $o.type eq 'Folder'}href="{$UI_BROWSER}?id={$o.id}" {/if}>[{$o.name}]</a>:&nbsp;&nbsp;
<a {if $o.type eq 'Folder'}href="{$UI_BROWSER}?id={$o.id}" {/if}>[{$o.title}]</a>:&nbsp;&nbsp;
</span>
</td>
@ -43,7 +43,8 @@
{if $o.type != 'Folder'}
&nbsp;<a href="{$UI_BROWSER}?act=getFile&id={$o.id}" class="button">[Access]</a>
&nbsp;<a href="{$UI_BROWSER}?act=getInfo&id={$o.id}" class="button">[Analyze]</a>
&nbsp;<a href="{$UI_BROWSER}?act=editMetaDataValues&id={$o.id}" class="button">[MetaData]</a>
&nbsp;<a href="{$UI_BROWSER}?act=editMetaDataValues&id={$o.id}" class="button">[MData]</a>
&nbsp;<a href="#" onclick="popup('{$UI_HANDLER}?act=add2SP&id={$o.id}', '2SP', 1, 1)" class="button">[SP]</a>
{/if}
{if $o.type eq 'Replica'}
&nbsp; (-&gt;$o.target})

View File

@ -5,15 +5,17 @@
{if is_array($sp)}
<table>
<tr><th></th><th>{tra 0=Name}</th><th>{tra 0=Duration}</th><th>{tra 0=Type}</th></tr>
<tr><th></th><th>{tra 0=Name}</th><th>{tra 0=Duration}</th><th>{tra 0=Type}</th><th>Del</th></tr>
{foreach from=$sp item=i}
<tr>
<td><input type="checkbox" name="spid[{$row.id}]"></td>
<td>{$i.name}</td>
<td><input type="checkbox" name="spid[{$i.id}]"></td>
<td>{$i.title}</td>
<td>{$i.duration}</td>
<td>{$i.type} </td>
<th><a href="#" onclick="popup('{$UI_HANDLER}?act=remFromSP&id={$i.id}', 'remFromSP', 1, 1)">X</th>
</tr>
{/foreach}
<tr><td></td><td colspan="2">[Edit]</td><td colspan="2">[Delete]</td></tr>
</table>
{/if}
</div>

View File

@ -21,18 +21,25 @@
{if $showSearchRes}
<div id="searchres">
{if (count($searchres.search))}
{foreach from=$searchres.search item=s}
<div style="background-color: {cycle values='#eeeeee, #dadada'}">{$s.gunid}
<a href="{$UI_BROWSER}?act=getMdata&id={$s.par_id}">[XML]</a>
<a href="{$UI_BROWSER}?act=editMetaDataValues&id={$s.par_id}">[Form]</a>
<a href="#" onClick="popup('{$UI_HANDLER}?act=add2SP&id={$s.par_id}', '2SP', 1, 1)">[SP]</a>
</div>
{/foreach}
<center>
{if ( is_array($searchres.search))}
<table>
<tr><th>{tra 0=Title}</th><th>{tra 0=Duration}</th><th></th></tr>
{foreach from=$searchres.search item=s}
<tr style="background-color: {cycle values='#eeeeee, #dadada'}">
<td>{$s.title}</td>
<td>{$s.duration}</td>
<td><a href="{$UI_BROWSER}?act=getMdata&id={$s.id}">[XML]</a>
<a href="{$UI_BROWSER}?act=editMetaDataValues&id={$s.id}">[Form]</a>
<a href="#" onClick="popup('{$UI_HANDLER}?act=add2SP&id={$s.id}', '2SP', 1, 1)">[SP]</a>
</td>
</tr>
</div>
{/foreach}
</table>
{else}
No match found.
{/if}
</center>
</div>
{/if}

View File

@ -102,8 +102,7 @@
}
#searchres {
text-align: center;
width: 300px;
width: 800px;
border-style : dotted;
padding : 5px;
margin-top: 10px;

View File

@ -34,12 +34,11 @@ if (is_array($_REQUEST['popup'])){
}
}
die();
};
$Smarty->assign('statusbar', $uiBrowser->getStationInfo($ui_fmask['systemPrefs']));
if ($uiBrowser->userid) {
if ($uiBrowser->userid) {
$Smarty->assign('showMenuTop', TRUE);
$Smarty->assign('sp', $uiBrowser->getSP());
$Smarty->assign('showSP', TRUE);
@ -152,7 +151,6 @@ if ($uiBrowser->userid) {
break;
}
}
#$Smarty->load_filter('output', 'trimwhitespace');
#$Smarty->register_outputfilter('smarty_outputfilter_trimwhitespace');
$Smarty->display('main.tpl');
?>

View File

@ -91,6 +91,10 @@ switch($_REQUEST['act']){
$uiHandler->add2SP($uiHandler->id);
break;
case "remFromSP":
$uiHandler->remFromSP($uiHandler->id);
break;
default:
$_SESSION["alertMsg"] = $uiHandler->tra("Unknown method: ").$_REQUEST["act"];
header("Location: ".UI_BROWSER);

View File

@ -106,7 +106,7 @@ class uiBase
} elseif (isset($v['type'])) {
$elem[$v['element']] =& $form->createElement($v['type'], $v['element'], $this->tra($v['label']),
($v[type]=='text' || $v['type']=='file' || $v['type']=='password') ? array_merge($v['attributes'], array('size'=>UI_INPUT_STANDARD_SIZE, 'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH)) :
($v['type']=='textarea' ? array_merge($v['attributes'], array('rows'=>UI_TEXTAREA_STANDART_ROWS, 'cols'=>UI_TEXTAREA_STANDART_COLS)) : $v['attributes'])
($v['type']=='textarea' ? array_merge($v['attributes'], array('rows'=>UI_TEXTAREA_STANDART_ROWS, 'cols'=>UI_TEXTAREA_STANDART_COLS)) : $v['attributes'])
);
if (!$v['groupit']) $form->addElement($elem[$v['element']]);
}
@ -149,7 +149,6 @@ class uiBase
}
reset($mask);
$form->validate();
}
@ -172,20 +171,20 @@ class uiBase
/**
* getInfo
* _getInfo
*
* Call getid3 library to analyze media file and show some results
*
* @param $id int local ID of file
* @param $format string
*/
function getInfo($id, $format)
function _getInfo($id, $format)
{
$ia = $this->gb->analyzeFile($id, $this->sessid);
if ($format=='array') {
return array(
'Format.Extent' => $ia['playtime_seconds'],
'Format.Extent' => $ia['playtime_string'],
'Format.Medium.Bitrate' => $ia['audio']['bitrate'],
'Format.Medium.Channels' => $ia['audio']['channelmode'],
'Format.Medium.Samplerate' => $ia['audio']['sample_rate'],
@ -211,8 +210,8 @@ class uiBase
xmlns:xbmf="http://www.streamonthefly.org/xbmf"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<dc:title >taken from test xml</dc:title>
<dcterms:extent >00:30:00.000000</dcterms:extent>
<dc:title>'.$this->_getFileTitle($id).'</dc:title>
<dc:format.extent>'.$ia['playtime_string'].'</dc:format.extent>
</metadata>
</audioClip>';
@ -253,17 +252,17 @@ class uiBase
function getSP()
{
$spData = $this->gb->loadPref($this->sessid, 'scratchPadContents');
if (!PEAR::isError($spData)) {
$spData = $this->gb->loadPref($this->sessid, UI_SCRATCHPAD_KEY);
if (!PEAR::isError($spData) && trim($spData) != '') {
$arr = explode(' ', $spData);
foreach($arr as $val) {
$pieces = explode(':', $val);
$filedata = $this->getFileInfo($pieces[0]);
$res[] = array('id' => $pieces[0],
#'added' => $pieces[1],
'name' => $filedata['name'],
'duration' => $filedata['playtime_string']
);
if (preg_match(UI_SCRATCHPAD_REGEX, $val)) {
$res[] = array_merge($this->_getMetaInfo($this->gb->_idFromGunid($pieces[0])),
array('added' => $pieces[1])
);
}
}
return ($res);
@ -272,58 +271,96 @@ class uiBase
}
}
function saveSP($data)
function _saveSP($data)
{
foreach($data as $val) {
$str .= $val['id'].':'.$val['added'].' ';
if (is_array($data)) {
foreach($data as $val) {
$str .= $val['gunid'].':'.$val['added'].' ';
}
}
$this->gb->savePref($this->sessid, 'scratchPadContents', trim($str));
$this->gb->savePref($this->sessid, UI_SCRATCHPAD_KEY, trim($str));
}
function add2SP($id)
{
$info = $this->_getMetaInfo($id);
$this->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
if ($sp = $this->getSP()) {
foreach ($sp as $val) {
if ($val['id'] == $id) $exists = TRUE;
if ($val['gunid'] == $info['gunid']) {
$exists = TRUE;
}
}
}
if(!$exists) {
$sp[] = array('id' => $id,
'added' => date('Y-m-d')
);
$this->saveSP($sp);
$this->_retmsg('Entry $1 added', $id);
$sp = array_merge(array(array('gunid' => $info['gunid'],
'added' => date('Y-m-d')
),
),
is_array($sp) ? $sp : NULL);
#print_r($sp);
$this->_saveSP($sp);
#$this->_retmsg('Entry $1 added', $gunid);
return TRUE;
} else {
$this->_retmsg('Entry $1 already exists', $id);
$this->_retmsg('Entry $1 already exists', $info['title']);
return FALSE;
}
$this->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
}
function _retmsg($msg, $p1=NULL, $p2=NULL, $p3=NULL, $p4=NULL, $p5=NULL, $p6=NULL, $p7=NULL, $p8=NULL, $p9=NULL)
function remFromSP($id)
{
$_SESSION['alertMsg'] = $this->tra($msg, $p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8, $p9);
$info = $this->_getMetaInfo($id);
$this->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
if ($sp = $this->getSP()) {
foreach ($sp as $val) {
if ($val['gunid'] != $info['gunid']) {
$new[] = $val;
}
}
$this->_saveSP($new);
$this->_retmsg('Entry $1 deleted', $info['title']);
return TRUE;
}
}
function getFileName($id)
function _retMsg($msg, $p1=NULL, $p2=NULL, $p3=NULL, $p4=NULL, $p5=NULL, $p6=NULL, $p7=NULL, $p8=NULL, $p9=NULL)
{
$_SESSION['alertMsg'] .= $this->tra($msg, $p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8, $p9).'\n';
}
function _getMetaInfo($id)
{
$data['id'] = $id;
$data['gunid'] = $this->gb->_gunidFromId($id);
$data['title'] = $this->_getMDataValue($id, 'Title');
$data['artist'] = $this->_getMDataValue($id, 'Artist');
$data['duration'] = substr($this->_getMDataValue($id, 'format.extent'), 0 ,8);
$data['type'] = $this->gb->existsPlaylist($this->sessid, $this->gb->_idFromgunid($id)) ? $this->tra('playlist') : $this->tra('file');
return ($data);
}
function _getMDataValue($id, $key)
{
$value = array_pop($this->gb->getMDataValue($id, $key, $this->sessid));
return $value['value'];
}
function _getFileTitle($id)
{
$file = array_pop($this->gb->getPath($id));
return $file['name'];
}
function getFileInfo($id)
{
$f = $this->gb->analyzeFile($id, $this->sessid);
return array(
'name' => $this->getFileName($id),
'type' => 0,
'filename' => $f['filename'],
'playtime_seconds' => $f['playtime_seconds'],
'playtime_string' => $f['playtime_string']
);
}
}
?>

View File

@ -116,6 +116,13 @@ class uiBrowser extends uiBase {
if(PEAR::isError($data['listdata'])){
$data['msg'] = $data['listdata']->getMessage();
$data['listdata'] = array();
} else {
foreach ($data['listdata'] as $key=>$val) {
if ($val['type'] != 'Folder')
$data['listdata'][$key]['title'] = $this->_getMDataValue($val['id'], 'title');
else
$data['listdata'][$key]['title'] = $val['name'];
}
}
return $data;
@ -134,7 +141,9 @@ class uiBrowser extends uiBase {
function getNewFileForm($id, $mask)
{
$form = new HTML_QuickForm('newfile', UI_STANDARD_FORM_METHOD, UI_HANDLER);
$form->setMaxFileSize($this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize'));
$form->setMaxFileSize(!PEAR::isError($this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize')) ?
$this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize')
: ini_get('upload_max_filesize'));
$form->setConstants(array('id' => $id));
$this->_parseArr2Form($form, $mask);
@ -155,7 +164,9 @@ class uiBrowser extends uiBase {
function getUploadFileForm($id, $mask)
{
$form = new HTML_QuickForm('upload', UI_STANDARD_FORM_METHOD, UI_HANDLER);
$form->setMaxFileSize($this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize'));
$form->setMaxFileSize(!PEAR::isError($this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize')) ?
$this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize')
: ini_get('upload_max_filesize'));
$form->setConstants(array('id' => $id));
$this->_parseArr2Form($form, $mask);
@ -353,15 +364,14 @@ class uiBrowser extends uiBase {
);
}
}
$searchCriteria = array('filetype' => 'audioclip',
$searchCriteria = array('filetype' => $formdata['filetype'],
'operator' => $formdata['operator'],
'conditions'=> $critArr
);
$results = $this->gb->localSearch($searchCriteria, $this->sessid);
foreach ($results['results'] as $rec) {
$res[] = array('gunid' => $rec,
'par_id' => $this->gb->_idFromGunid($rec));
$res[] = $this->_getMetaInfo($this->gb->_idFromGunid($rec));
}
return array('search' => $res,
@ -389,7 +399,7 @@ class uiBrowser extends uiBase {
/**
* getMdata
*
* Show file's metadata as XML
* Get file's metadata as XML
*
* @param id int, local id of stored file
* @return array
@ -400,21 +410,6 @@ class uiBrowser extends uiBase {
}
/**
* getMdataValue
*
* Get Files Metadata Record
*
* @param id int, local id of stored file
* @param cetagory string, metadata element name
* @return array
*/
function _getMdataValue($id, $category)
{
return($this->gb->getMdataValue($id, $category, $this->sessid));
}
/**
* getMetaDataForm
*
@ -423,7 +418,7 @@ class uiBrowser extends uiBase {
* @param id int
* @return string (html)
*/
function getMetadataForm($id, &$mask, $get=FALSE, $data=NULL)
function getMetadataForm($id, $mask, $get=FALSE, $data=NULL)
{
$form = new HTML_QuickForm('tabs', UI_STANDARD_FORM_METHOD, UI_BROWSER);
$this->_parseArr2Form($form, $mask['tabs']);
@ -444,11 +439,11 @@ class uiBrowser extends uiBase {
foreach ($mask['tabs']['group']['group'] as $key) {
foreach ($mask['pages'][$key] as $k=>$v) {
$mask['pages'][$key][$k]['element'] = $key.'__'.$v['element'];
$mask['pages'][$key][$k]['attributes'] = array ('onChange' => "spread(this, '".$v['element']."')");
$mask['pages'][$key][$k]['attributes'] = array_merge($mask['pages'][$key][$k]['attributes'], array('onChange' => "spread(this, '".$v['element']."')"));
## recive data from GreenBox
if ($get) {
$mask['pages'][$key][$k]['default'] = array_pop($this->gb->getMDataValue($id, strtr($v['element'], '_', '.'), $this->sessid));
$mask['pages'][$key][$k]['default'] = $this->_getMDataValue($id, strtr($v['element'], '_', '.'));
}
## get data from parameter

View File

@ -1,13 +1,15 @@
<?php
session_start();
require_once dirname(__FILE__).'/conf.php';
// LS classes/functions
## LS classes/functions #############################################
require_once dirname(__FILE__).'/conf.php';
require_once dirname(__FILE__).'/ui_base.inc.php';
require_once dirname(__FILE__).'/ui_browser.class.php';
require_once dirname(__FILE__).'/../../storageServer/var/GreenBox.php';
// well known classes
## well known classes ###############################################
require_once dirname(__FILE__).'/html/Smarty/libs/Smarty.class.php';
require_once 'DB.php';
@ -19,12 +21,18 @@ require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
#PEAR::setErrorHandling(PEAR_ERROR_PRINT);
// some global vars/objects
## initialize objects ###############################################
$Smarty = new Smarty;
$uiBrowser = new uiBrowser($config);
$uiBase = new uiBase($config);
$uiBase = new uiBase($config);
## load Smarty+filters ##############################################
require_once dirname(__FILE__).'/SmartyExtensions.inc.php';
#$Smarty->load_filter('output', 'trimwhitespace');
$Smarty->load_filter('post', 'template_marker');
## some basic things ################################################
$Smarty->assign('UI_BROWSER', UI_BROWSER);
@ -35,6 +43,8 @@ $Smarty->assign('user', array('sessid' => &$uiBrowser->sessid,
'login' => &$uiBrowser->login
)
);
## retransfer incomplete formdata from SESSION to POST-data #########
if(is_array($_SESSION['retransferFormData'])){
foreach($_SESSION['retransferFormData'] as $k=>$v){
@ -43,5 +53,7 @@ if(is_array($_SESSION['retransferFormData'])){
unset($_SESSION['retransferFormData']);
}
## mask for forms, at the end because $uiBase is used ###############
require_once dirname(__FILE__).'/ui_fmask.inc.php';
?>

View File

@ -16,11 +16,8 @@ $ui_fmask = array(
'element' => 'maxfilesize',
'type' => 'text',
'label' => 'Maximum File Size for Upload',
'required' => TRUE
),
array(
'rule' => 'numeric',
'element' => 'maxfilesize',
'required' => TRUE,
'default' => ini_get('upload_max_filesize')
),
array(
'rule' => 'nopunctuation',
@ -63,7 +60,8 @@ $ui_fmask = array(
array(
'element' => 'stationlogo',
'type' => 'file',
'label' => 'Station Logo'
'label' => 'Station Logo',
'requiredmsg'=> 'please select Logo file'
),
array(
'element' =>'Submit',
@ -197,16 +195,13 @@ $ui_fmask = array(
'audio/mpeg' => 'audio/mpeg'
)
),
/*
array(
'element' => 'Format_Extent',
'type' => 'date',
'options' => array(
'format' => 'His'
),
'type' => 'text',
'label' => 'Format_Extent',
'required' => TRUE
), */
#'attributes'=> array('readonly' => 'on')
),
/*
array(
'element' => 'Format_Extent_h',
'type' => 'select',
@ -234,7 +229,7 @@ $ui_fmask = array(
#'format' => '/([1-9]0)|([1-9]{2})|(0[1-9])/',
#'arg1' => 'Please enter Format_Extent',
#'howmany' => 1
),
), */
),
'Music_Basic' => array(
array(
@ -296,37 +291,11 @@ $ui_fmask = array(
'label' => 'Description_Rating',
'rule' => 'numeric',
),
/*
array(
'element' => 'Format_Extent',
'type' => 'date',
'options' => array(
'format' => 'His'
),
'label' => 'Format_Extent'
), */
array(
'element' => 'Format_Extent_h',
'type' => 'select',
'options' => $uiBase->_getDArr('h'),
'groupit' => TRUE
),
array(
'element' => 'Format_Extent_m',
'type' => 'select',
'options' => $uiBase->_getDArr('m'),
'groupit' => TRUE
),
array(
'element' => 'Format_Extent_s',
'type' => 'select',
'options' => $uiBase->_getDArr('h'),
'groupit' => TRUE
),
array(
'group' => array('Music_Basic__Format_Extent_h', 'Music_Basic__Format_Extent_m', 'Music_Basic__Format_Extent_s'),
#'name' => 'gr_Format_Extent',
'type' => 'text',
'label' => 'Format_Extent',
'attributes'=> array('readonly' => 'on')
),
),
'Music_Advanced'=> array(
@ -680,11 +649,6 @@ $ui_fmask = array(
'required' => TRUE,
'requiredmsg'=> 'please select Media file'
),
array(
'element' => 'new_filename',
'type' => 'text',
'label' => 'New Filename'
),
array(
'element' => 'mdatafile',
'type' => 'file',
@ -716,11 +680,6 @@ $ui_fmask = array(
'required' => TRUE,
'requiredmsg'=> 'please select Media file'
),
array(
'element' => 'new_filename',
'type' => 'text',
'label' => 'New Filename'
),
array(
'element' => 'Submit',
'type' => 'submit',
@ -756,6 +715,16 @@ $ui_fmask = array(
'and' => 'And',
)
),
array(
'element' => 'filetype',
'type' => 'select',
'label' => 'Filetype',
'options' => array(
'File' => '*',
'audioclip' => 'Audioclip',
'playlist' => 'Playlist'
)
),
array(
'element' => 'addrow',
'type' => 'button',

View File

@ -33,7 +33,7 @@ class uiHandler extends uiBase {
* @param pass string, password
*/
function login(&$formdata, &$mask)
{
{
if ($this->_validateForm($formdata, $mask)) {
$sessid = $this->gb->login($formdata['login'], $formdata['pass']);
if($sessid && !PEAR::isError($sessid)){
@ -96,16 +96,19 @@ class uiHandler extends uiBase {
chmod($mdtmp, 0664);
}
}
$r = $this->gb->putFile($id, $formdata['new_filename'] ? $formdata['new_filename'] : $formdata['mediafile']['name'], $ntmp, $mdtmp, $this->sessid);
$r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, $mdtmp, $this->sessid);
if(PEAR::isError($r)) $this->alertMsg = $r->getMessage();
else{
# $gb->updateMetadataDB($gb->_pathFromId($r), $mdata, $sessid);
@unlink($ntmp);
@unlink($mdtmp);
}
$this->add2SP($r);
$this->redirUrl = UI_BROWSER."?id=".$id;
return $r;
} else {
$this->redirUrl = UI_BROWSER."?act=newfile&id=".$id;
return FALSE;
}
}
@ -130,21 +133,22 @@ class uiHandler extends uiBase {
move_uploaded_file($formdata['mediafile']['tmp_name'], $ntmp);
chmod($ntmp, 0664);
$r = $this->gb->putFile($id, $formdata['new_filename'] ? $formdata['new_filename'] : $formdata['mediafile']['name'], $ntmp, NULL, $this->sessid);
$r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, NULL, $this->sessid);
if(PEAR::isError($r)) $this->alertMsg = $r->getMessage();
else{
# $gb->updateMetadataDB($gb->_pathFromId($r), $mdata, $sessid);
@unlink($ntmp);
@unlink($mdtmp);
}
## extract some metadata with getID3
$this->gb->replaceMetadata($r, $this->getInfo($r, 'xml'), $mdataLoc = 'string', $this->sessid);
$this->gb->replaceMetadata($r, $this->_getInfo($r, 'xml'), 'string', $this->sessid);
$this->add2SP($r);
$this->redirUrl = UI_BROWSER."?act=editMetaDataValues&id=$r";
return $r;
} else {
$this->redirUrl = UI_BROWSER."?act=upload_1&id=$id";
return FALSE;
}
}
@ -453,7 +457,7 @@ class uiHandler extends uiBase {
$this->_dateArr2Str(&$mData);
foreach ($mData as $key=>$val) {
#$this->gb->setMDataValue($formdata['id'], $key, $val, $this->sessid)
$this->gb->setMDataValue($formdata['id'], $key, $this->sessid, $val);
}
$this->alertMsg = $this->tra('Metadata saved');
@ -469,6 +473,24 @@ class uiHandler extends uiBase {
return FALSE;
}
## test for uploadet files bacause HTMLQuickForm::validate() ignores them ####
if (is_array($form->_submitFiles)) {
foreach ($form->_submitFiles as $key => $val) {
if ($val['error']) {
switch ($val['error']) {
case 1: $was_error = TRUE; $this->_retMsg('Uploaded File $1 is greater than System setting.', $mask[$key]['label']); break;
case 2: $was_error = TRUE; $this->_retMsg('Uploaded File $1 is greater than LS setting.', $mask[$key]['label']); break;
case 3: $was_error = TRUE; $this->_retMsg('File $1 was uploadet partly.', $mask[$key]['label']); break;
case 4: if ($mask[$key]['required']) {$was_error = TRUE; $this->_retMsg('File $1 was not uploadet.', $mask[$key]['label']);} break;
}
}
}
if ($was_error) {
$_SESSION['retransferFormData'] = array_merge($_REQUEST, $_FILES);
return FALSE;
}
}
/*
foreach($mask as $k) {
if ($k['type']=='file' && $k['required']==TRUE) {
if ($_FILES[$k['element']]['error']) {
@ -476,9 +498,7 @@ class uiHandler extends uiBase {
return FALSE;
}
}
}
reset($mask);
} */
return TRUE;
}
@ -504,10 +524,12 @@ class uiHandler extends uiBase {
}
}
$this->alertMsg = $this->tra('Settings saved');
return;
$this->_retMsg('Settings saved');
return TRUE;
} else {
$this->_retMsg('Error saving Settings');
return FALSE;
}
$this->alertMsg = $this->tra('Error saving Settings');
}

View File

@ -1,13 +1,15 @@
<?php
session_start();
require_once dirname(__FILE__).'/conf.php';
// LS classes/functions
## LS classes/functions #############################################
require_once dirname(__FILE__).'/conf.php';
require_once dirname(__FILE__).'/ui_base.inc.php';
require_once dirname(__FILE__).'/ui_handler.class.php';
require_once dirname(__FILE__).'/../../storageServer/var/GreenBox.php';
// well known classes
## well known classes ###############################################
require_once 'DB.php';
require_once 'HTML/QuickForm.php';
@ -16,8 +18,12 @@ require_once 'HTML/QuickForm.php';
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
#PEAR::setErrorHandling(PEAR_ERROR_PRINT);
## initialize objects ###############################################
$uiHandler = new uiHandler($config);
$uiBase = new uiBase($config);
## mask for forms, at the end because $uiBase is used ###############
require_once dirname(__FILE__).'/ui_fmask.inc.php';
?>