diff --git a/livesupport/modules/htmlUI/var/conf.php b/livesupport/modules/htmlUI/var/conf.php
index a3f7d1426..6a77ad84d 100644
--- a/livesupport/modules/htmlUI/var/conf.php
+++ b/livesupport/modules/htmlUI/var/conf.php
@@ -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}( )?)+$/');
?>
\ No newline at end of file
diff --git a/livesupport/modules/htmlUI/var/html/templates/objects.tpl b/livesupport/modules/htmlUI/var/html/templates/objects.tpl
index 880a6cf75..adb6d51a2 100644
--- a/livesupport/modules/htmlUI/var/html/templates/objects.tpl
+++ b/livesupport/modules/htmlUI/var/html/templates/objects.tpl
@@ -18,7 +18,7 @@
{else}
{str_repeat str=' ' count=3}
{/if}
- [{$o.name}]:
+ [{$o.title}]:
@@ -43,7 +43,8 @@
{if $o.type != 'Folder'}
[Access]
[Analyze]
- [MetaData]
+ [MData]
+ [SP]
{/if}
{if $o.type eq 'Replica'}
(->$o.target})
diff --git a/livesupport/modules/htmlUI/var/html/templates/scratchpad.tpl b/livesupport/modules/htmlUI/var/html/templates/scratchpad.tpl
index c02fac660..8e1e921c6 100644
--- a/livesupport/modules/htmlUI/var/html/templates/scratchpad.tpl
+++ b/livesupport/modules/htmlUI/var/html/templates/scratchpad.tpl
@@ -5,15 +5,17 @@
{if is_array($sp)}
{/if}
diff --git a/livesupport/modules/htmlUI/var/html/templates/search.tpl b/livesupport/modules/htmlUI/var/html/templates/search.tpl
index 06e4cbbdf..08e06f2d6 100644
--- a/livesupport/modules/htmlUI/var/html/templates/search.tpl
+++ b/livesupport/modules/htmlUI/var/html/templates/search.tpl
@@ -21,18 +21,25 @@
{if $showSearchRes}
-
- {if (count($searchres.search))}
- {foreach from=$searchres.search item=s}
-
- {/foreach}
+
+ {if ( is_array($searchres.search))}
+
+ {tra 0=Title} | {tra 0=Duration} | |
+ {foreach from=$searchres.search item=s}
+
+ {$s.title} |
+ {$s.duration} |
+ [XML]
+ [Form]
+ [SP]
+ |
+
+
+ {/foreach}
+
{else}
No match found.
{/if}
-
+
{/if}
\ No newline at end of file
diff --git a/livesupport/modules/htmlUI/var/html/templates/styles.css b/livesupport/modules/htmlUI/var/html/templates/styles.css
index ebae7afbf..a2396a53f 100644
--- a/livesupport/modules/htmlUI/var/html/templates/styles.css
+++ b/livesupport/modules/htmlUI/var/html/templates/styles.css
@@ -102,8 +102,7 @@
}
#searchres {
- text-align: center;
- width: 300px;
+ width: 800px;
border-style : dotted;
padding : 5px;
margin-top: 10px;
diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php
index ec2b7c776..dec930d05 100644
--- a/livesupport/modules/htmlUI/var/html/ui_browser.php
+++ b/livesupport/modules/htmlUI/var/html/ui_browser.php
@@ -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');
?>
diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php
index 90dce9fee..4e45f26a9 100644
--- a/livesupport/modules/htmlUI/var/html/ui_handler.php
+++ b/livesupport/modules/htmlUI/var/html/ui_handler.php
@@ -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);
diff --git a/livesupport/modules/htmlUI/var/ui_base.inc.php b/livesupport/modules/htmlUI/var/ui_base.inc.php
index 4ba0e0643..c4f83babf 100644
--- a/livesupport/modules/htmlUI/var/ui_base.inc.php
+++ b/livesupport/modules/htmlUI/var/ui_base.inc.php
@@ -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"
>
- taken from test xml
- 00:30:00.000000
+ '.$this->_getFileTitle($id).'
+ '.$ia['playtime_string'].'
';
@@ -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']
- );
- }
}
?>
diff --git a/livesupport/modules/htmlUI/var/ui_browser.class.php b/livesupport/modules/htmlUI/var/ui_browser.class.php
index ce9616a47..c50379c03 100644
--- a/livesupport/modules/htmlUI/var/ui_browser.class.php
+++ b/livesupport/modules/htmlUI/var/ui_browser.class.php
@@ -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
diff --git a/livesupport/modules/htmlUI/var/ui_browser_init.php b/livesupport/modules/htmlUI/var/ui_browser_init.php
index a448b0bde..e51b94c19 100644
--- a/livesupport/modules/htmlUI/var/ui_browser_init.php
+++ b/livesupport/modules/htmlUI/var/ui_browser_init.php
@@ -1,13 +1,15 @@
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';
?>
diff --git a/livesupport/modules/htmlUI/var/ui_fmask.inc.php b/livesupport/modules/htmlUI/var/ui_fmask.inc.php
index 308ff4726..dd98d9951 100644
--- a/livesupport/modules/htmlUI/var/ui_fmask.inc.php
+++ b/livesupport/modules/htmlUI/var/ui_fmask.inc.php
@@ -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',
diff --git a/livesupport/modules/htmlUI/var/ui_handler.class.php b/livesupport/modules/htmlUI/var/ui_handler.class.php
index c12f49dac..67fceee54 100644
--- a/livesupport/modules/htmlUI/var/ui_handler.class.php
+++ b/livesupport/modules/htmlUI/var/ui_handler.class.php
@@ -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');
}
diff --git a/livesupport/modules/htmlUI/var/ui_handler_init.php b/livesupport/modules/htmlUI/var/ui_handler_init.php
index a436f2abc..429bd7940 100644
--- a/livesupport/modules/htmlUI/var/ui_handler_init.php
+++ b/livesupport/modules/htmlUI/var/ui_handler_init.php
@@ -1,13 +1,15 @@