diff --git a/livesupport/modules/htmlUI/var/SchedulerPhpClient.class.php b/livesupport/modules/htmlUI/var/SchedulerPhpClient.class.php index ebfdededf..f906ba351 100755 --- a/livesupport/modules/htmlUI/var/SchedulerPhpClient.class.php +++ b/livesupport/modules/htmlUI/var/SchedulerPhpClient.class.php @@ -23,15 +23,15 @@ Author : $Author: sebastian $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/SchedulerPhpClient.class.php,v $ ------------------------------------------------------------------------------*/ /* ================================================================= includes */ require_once 'DB.php'; -#include_once dirname(__FILE__)."/../../storageServer/var/xmlrpc/XML/RPC.php"; -#include_once dirname(__FILE__)."/../../storageServer/var/conf.php"; +require_once "XML/RPC.php"; +#include_once "../conf.php"; /* ================================================== method definition array */ /** @@ -41,14 +41,17 @@ require_once 'DB.php'; * */ $mdefs = array( + "listMethods" => array('m'=>"system.listMethods", 'p'=>NULL, 't'=>NULL), "AddAudioClipToPlaylistMethod" => array( - 'm'=>'AddAudioClipToPlaylistMethod', + 'm'=>'addAudioClipToPlaylist', 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'audioClipId'/*string*/, 'relativeOffset'/*int*/), + 't'=>array('string', 'string', 'string', 'int'), 'r'=>array('playlistElementId'/*string*/), 'e'=>array( '301'=>'invalid argument format', @@ -63,8 +66,9 @@ $mdefs = array( ) ), "CreatePlaylistMethod" => array( - 'm'=>'CreatePlaylistMethod', + 'm'=>'createPlaylist', 'p'=>array('sessionId'/*string*/), + 't'=>array('string'), 'r'=>array('playlist'/*string*/), 'e'=>array( '201'=>'invalid argument format', @@ -73,8 +77,9 @@ $mdefs = array( ) ), "DeletePlaylistMethod" => array( - 'm'=>'DeletePlaylistMethod', + 'm'=>'deletePlaylist', 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), + 't'=>array('string', 'string'), 'r'=>array(), 'e'=>array( '901'=>'invalid argument format', @@ -86,8 +91,9 @@ $mdefs = array( ) ), "DisplayAudioClipMethod" => array( - 'm'=>'DisplayAudioClipMethod', + 'm'=>'displayAudioClip', 'p'=>array('sessionId'/*string*/, 'audioClipId'/*string*/), + 't'=>array('string', 'string'), 'r'=>array('audioClip'/*string*/), 'e'=>array( '601'=>'invalid argument format', @@ -97,8 +103,9 @@ $mdefs = array( ) ), "DisplayAudioClipsMethod" => array( - 'm'=>'DisplayAudioClipsMethod', + 'm'=>'displayAudioClips', 'p'=>array('sessionId'/*string*/), + 't'=>array('string'), 'r'=>array(array('audioClip'/*string*/)), 'e'=>array( '1801'=>'invalid argument format', @@ -107,8 +114,9 @@ $mdefs = array( ) ), "DisplayPlaylistMethod" => array( - 'm'=>'DisplayPlaylistMethod', + 'm'=>'displayPlaylist', 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), + 't'=>array('string', 'string'), 'r'=>array('playlist'/*string*/), 'e'=>array( '1001'=>'invalid argument format', @@ -118,8 +126,9 @@ $mdefs = array( ) ), "DisplayPlaylistsMethod" => array( - 'm'=>'DisplayPlaylistsMethod', + 'm'=>'displayPlaylists', 'p'=>array('sessionId'/*string*/), + 't'=>array('string'), 'r'=>array(array('playlist'/*string*/)), 'e'=>array( '1701'=>'invalid argument format', @@ -128,8 +137,9 @@ $mdefs = array( ) ), "DisplayScheduleMethod" => array( - 'm'=>'DisplayScheduleMethod', + 'm'=>'displaySchedule', 'p'=>array('sessionId'/*string*/, 'from'/*datetime*/, 'to'/*datetime*/), + 't'=>array('string', 'dateTime.iso8601', 'dateTime.iso8601'), 'r'=>array(array('id'/*int*/, 'playlistId'/*string*/, 'start'/*datetime*/, 'end'/*datetime*/)), 'e'=>array( '1101'=>'invalid argument format', @@ -139,8 +149,9 @@ $mdefs = array( ) ), "GeneratePlayReportMethod" => array( - 'm'=>'GeneratePlayReportMethod', + 'm'=>'generatePlayReport', 'p'=>array('sessionId'/*string*/, 'from'/*datetime*/, 'to'/*datetime*/), + 't'=>array('string', 'dateTime.iso8601', 'dateTime.iso8601'), 'r'=>array(array('audioClipId'/*string*/, 'timestamp'/*datetime*/)), 'e'=>array( '1501'=>'invalid argument format', @@ -150,21 +161,24 @@ $mdefs = array( ) ), "GetSchedulerTimeMethod" => array( - 'm'=>'GetSchedulerTimeMethod', + 'm'=>'getSchedulerTime', 'p'=>array(), + 't'=>array(), 'r'=>array('schedulerTime'/*datetime*/), 'e'=>array( ) ), "GetVersionMethod" => array( - 'm'=>'GetVersionMethod', + 'm'=>'getVersion', 'p'=>array(), + 't'=>array(), 'r'=>array('version'/*string*/), 'e'=>array() ), "LoginMethod" => array( - 'm'=>'LoginMethod', + 'm'=>'login', 'p'=>array('login'/*string*/, 'password'/*string*/), + 't'=>array('string', 'string'), 'r'=>array('sessionId'/*string*/), 'e'=>array( '2001'=>'invalid argument format', @@ -174,8 +188,9 @@ $mdefs = array( ) ), "LogoutMethod" => array( - 'm'=>'LogoutMethod', + 'm'=>'logout', 'p'=>array('sessionId'/*string*/), + 't'=>array('string'), 'r'=>array(), 'e'=>array( '2101'=>'invalid argument format', @@ -184,8 +199,9 @@ $mdefs = array( ) ), "OpenPlaylistForEditingMethod" => array( - 'm'=>'OpenPlaylistForEditingMethod', + 'm'=>'openPlaylistForEditing', 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), + 't'=>array('string', 'string'), 'r'=>array('playlist'/*string*/), 'e'=>array( '101'=>'invalid argument format', @@ -195,8 +211,9 @@ $mdefs = array( ) ), "RemoveAudioClipFromPlaylistMethod" => array( - 'm'=>'RemoveAudioClipFromPlaylistMethod', + 'm'=>'removeAudioClipFromPlaylist', 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'playlistElementId'/*string*/), + 't'=>array('string', 'string', 'string'), 'r'=>array(), 'e'=>array( '401'=>'invalid argument format', @@ -209,8 +226,9 @@ $mdefs = array( ) ), "RemoveFromScheduleMethod" => array( - 'm'=>'RemoveFromScheduleMethod', + 'm'=>'removeFromSchedule', 'p'=>array('sessionId'/*string*/, 'scheduleEntryId'/*string*/), + 't'=>array('string', 'string'), 'r'=>array(), 'e'=>array( '1201'=>'invalid argument format', @@ -220,8 +238,9 @@ $mdefs = array( ) ), "RescheduleMethod" => array( - 'm'=>'RescheduleMethod', + 'm'=>'reschedule', 'p'=>array('sessionId'/*string*/, 'scheduleEntryId'/*string*/, 'playtime'/*datetime*/), + 't'=>array('string', 'string', 'dateTime.iso8601'), 'r'=>array(), 'e'=>array( '1301'=>'invalid argument format', @@ -233,14 +252,16 @@ $mdefs = array( ) ), "ResetStorageMethod" => array( - 'm'=>'ResetStorageMethod', + 'm'=>'resetStorage', 'p'=>array(), + 't'=>array(), 'r'=>array(), 'e'=>array('3001'=>'storage client reported an error'), ), "RevertEditedPlaylistMethod" => array( - 'm'=>'RevertEditedPlaylistMethod', + 'm'=>'revertEditedPlaylist', 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), + 't'=>array('string', 'string'), 'r'=>array(), 'e'=>array( '801'=>'invalid argument format', @@ -251,8 +272,9 @@ $mdefs = array( ) ), "SavePlaylistMethod" => array( - 'm'=>'SavePlaylistMethod', + 'm'=>'savePlaylist', 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), + 't'=>array('string', 'string'), 'r'=>array(), 'e'=>array( '701'=>'invalid argument format', @@ -263,8 +285,9 @@ $mdefs = array( ) ), "UpdateFadeInFadeOutMethod" => array( - 'm'=>'UpdateFadeInFadeOutMethod', + 'm'=>'updateFadeInFadeOut', 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'playlistElementId'/*string*/, 'fadeIn'/*int*/, 'fadeOut'/*int*/), + 't'=>array('string', 'string', 'string', 'int', 'int'), 'r'=>array(), 'e'=>array( '1601'=>'invalid argument format', @@ -279,22 +302,24 @@ $mdefs = array( ) ), "UploadPlaylistMethod" => array( - 'm'=>'UploadPlaylistMethod', + 'm'=>'uploadPlaylist', 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'playtime'/*datetime*/), + 't'=>array('string', 'string', 'dateTime.iso8601'), 'r'=>array('scheduleEntryId'/*string*/), 'e'=>array( '1401'=>'invalid argument format', '1402'=>'missing playlist ID argument', '1403'=>'missing playtime argument', '1404'=>'playlist not found', - '1405'=>'timeframe not available', + '1405'=>'timeframe not aaaaavailable', '1406'=>'could not schedule playlist', '1420'=>'missing session ID argument', ) ), "ValidatePlaylistMethod" => array( - 'm'=>'ValidatePlaylistMethod', + 'm'=>'validatePlaylist', 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), + 't'=>array('string', 'string'), 'r'=>array('valid'/*bool*/), 'e'=>array( '501'=>'invalid argument format', @@ -307,6 +332,7 @@ $mdefs = array( "LoginGB" => array( 'm'=>'locstor.login', 'p'=>array('login'/*string*/, 'pass'/*string*/), + 't'=>array('string', 'string'), 'r'=>array('sessid'/*string*/), 'e'=>array( '2001'=>'invalid argument format', @@ -318,6 +344,7 @@ $mdefs = array( "LogoutGB" => array( 'm'=>'locstor.logout', 'p'=>array('sessid'/*string*/), + 't'=>array('string'), 'r'=>array('status'/*boolean*/), 'e'=>array( '2001'=>'invalid argument format', @@ -374,11 +401,11 @@ class SchedulerPhpClient{ $this->debug = $debug; $this->verbose = $verbose; $confPrefix = "scheduler"; - #$confPrefix = "storage"; + # $confPrefix = "storage"; $serverPath = "http://{$config["{$confPrefix}UrlHost"]}:{$config["{$confPrefix}UrlPort"]}". "{$config["{$confPrefix}UrlPath"]}/{$config["{$confPrefix}XMLRPC"]}"; - #$serverPath = "http://localhost:80/livesupportStorageServer/xmlrpc/xrLocStor.php"; + #$serverPath = "http://localhost:80/livesupportStorageServerCVS/xmlrpc/xrLocStor.php"; if($this->verbose) echo "serverPath: $serverPath\n"; $url = parse_url($serverPath); $this->client = new XML_RPC_Client($url['path'], $url['host'], $url['port']); @@ -434,11 +461,14 @@ class SchedulerPhpClient{ function callMethod($method, $gettedPars) { $parr = array(); + $XML_RPC_val = new XML_RPC_Value; foreach($this->mdefs[$method]['p'] as $i=>$p){ - $parr[$p] = $gettedPars[$i]; + $parr[$p] = new XML_RPC_Value; + $parr[$p]->addScalar($gettedPars[$i], $this->mdefs[$method]['t'][$i]); } + $XML_RPC_val->addStruct($parr); $fullmethod = $this->mdefs[$method]['m']; - $msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($parr))); + $msg = new XML_RPC_Message($fullmethod, array($XML_RPC_val)); if($this->verbose){ echo "parr:\n"; var_dump($parr); @@ -446,17 +476,23 @@ class SchedulerPhpClient{ echo $msg->serialize()."\n"; } $this->client->setDebug($this->debug); - $res = $this->client->send($msg); + if (!$res = $this->client->send($msg)) { + return array('error' => array('code' => -1, 'message' => 'Cannot connect to Scheduler')); + } if($res->faultCode() > 0) { + return array('error' => array('code' => $res->faultCode(), 'message' => $res->faultString())); ## changed by sebastian + /* return $this->dbc->raiseError( "SchedulerPhpClient::$method:".$res->faultString()." ". $res->faultCode()."\n", $res->faultCode() - ); + ); */ } - if($verbose){ + if($this->verbose){ echo "result:\n"; echo $res->serialize(); } + $val = $res->value(); +# echo"
\n"; var_dump($val); exit;
         $resp = XML_RPC_decode($res->value());
         return $resp;
     }
@@ -472,18 +508,25 @@ class SchedulerPhpClient{
 
 /*
 // db object handling:
+include('conf.php');
 $dbc = DB::connect($config['dsn'], TRUE);
 $dbc->setFetchMode(DB_FETCHMODE_ASSOC);
 $dbc->setErrorHandling(PEAR_ERROR_RETURN);
 
 // scheduler client instantiation:
 $spc =& SchedulerPhpClient::factory($dbc, $mdefs, $config);
+#$spc =& SchedulerPhpClient::factory($dbc, $mdefs, $config, 0, TRUE);
 
 // call of chosen function by name according to key values in $mdefs array:
 // (for testing on storageServer XMLRPC I've changes confPrefix in
 //  SchedulerPhpClient constructor from 'scheduler' to 'storage' value)
-$r = $spc->LoginGB('root', 'q'); var_dump($r);
+#$r = $spc->LoginGB('root', 'q'); var_dump($r);
 #$r = $spc->LogoutGB(''); var_dump($r);
+#$r = $spc->DisplayScheduleMethod($this->Base->sessid, '2005-01-01 00:00:00.000000', '2005-02-01 00:00:00.000000'); var_dump($r);
+$r = $spc->DisplayScheduleMethod($this->Base->sessid, '20040101T00:00:00', '20050401T00:00:00'); var_dump($r);
+#$r = $spc->LoginMethod('root', 'q'); var_dump($r);
+#$r = $spc->LogoutMethod('dummySessionId3-1714636915'); var_dump($r);
+#$r = $spc->listMethods(); var_dump($r);
+#$r = $spc->GetSchedulerTimeMethod(); var_dump($r);
 */
-
 ?>
\ No newline at end of file
diff --git a/livesupport/modules/htmlUI/var/conf.php b/livesupport/modules/htmlUI/var/conf.php
index 040940be7..6206d11c1 100644
--- a/livesupport/modules/htmlUI/var/conf.php
+++ b/livesupport/modules/htmlUI/var/conf.php
@@ -1,126 +1,4 @@
 
- *   
dsn
datasource setting - *
tblNamePrefix
prefix for table names in the database - *
authCookieName
secret token cookie name - *
storageDir
main directory for storing binary media files - *
bufferDir
directory for temporary files - *
transDir
directory for incomplete transferred files - *
accessDir
directory for symlinks to accessed files - *
isArchive
local/central flag - *
storageUrlPath
path-URL-part of storageServer base dir - *
storageXMLRPC
XMLRPC server script address relative to storageUrlPath - *
storageUrlHost, storageUrlPort
host and port of storageServer - *
archiveUrlPath
path-URL-part of archiveServer base dir - *
archiveXMLRPC
XMLRPC server script address relative to archiveUrlPath - *
archiveUrlHost, archiveUrlPort
host and port of archiveServer - * - */ -$config = array( - /* ================================================== basic configuration */ - 'dsn' => array( - 'username' => 'test', - 'password' => 'test', - 'hostspec' => 'localhost', - 'phptype' => 'pgsql', - 'database' => 'LiveSupport-test', - ), - 'tblNamePrefix' => 'ls_', - 'authCookieName'=> 'lssid', - 'StationPrefsGr'=> 'StationPrefs', - 'AllGr' => 'All', - 'storageDir' => dirname(__FILE__).'/../../storageServer/var/stor', - 'bufferDir' => dirname(__FILE__).'/../../storageServer/var/stor/buffer', - 'transDir' => dirname(__FILE__).'/../../storageServer/var/trans', - 'accessDir' => dirname(__FILE__).'/../../storageServer/var/access', - 'isArchive' => FALSE, - - /* ==================================================== URL configuration */ - 'storageUrlPath' => '/livesupportStorageServer', - 'storageXMLRPC' => 'xmlrpc/xrLocStor.php', - 'storageUrlHost' => 'localhost', - 'storageUrlPort' => 80, - - /* ================================================ archive configuration */ - 'archiveUrlPath' => '/livesupportArchiveServer', - 'archiveXMLRPC' => 'xmlrpc/xrArchive.php', - 'archiveUrlHost' => 'localhost', - 'archiveUrlPort' => 80, - 'archiveAccountLogin' => 'root', - 'archiveAccountPass' => 'q', - - /* ============================================== scheduler configuration */ - 'schedulerUrlPath' => '', - 'schedulerXMLRPC' => 'RC2', - 'schedulerUrlHost' => 'localhost', - 'schedulerUrlPort' => 3344, - - /* ==================================== aplication-specific configuration */ - 'objtypes' => array( - 'RootNode' => array('Folder'), - 'Storage' => array('Folder', 'File', 'Replica'), - 'Folder' => array('Folder', 'File', 'Replica'), - 'File' => array(), - 'audioclip' => array(), - 'playlist' => array(), - 'Replica' => array(), - ), - 'allowedActions'=> array( - 'RootNode' => array('classes', 'subjects'), - 'Folder' => array('editPrivs', 'write', 'read'), - 'File' => array('editPrivs', 'write', 'read'), - 'audioclip' => array('editPrivs', 'write', 'read'), - 'playlist' => array('editPrivs', 'write', 'read'), - 'Replica' => array('editPrivs', 'write', 'read'), - '_class' => array('editPrivs', 'write', 'read'), - ), - 'allActions' => array( - 'editPrivs', 'write', 'read', 'classes', 'subjects' - ), - - /* ============================================== auxiliary configuration */ - 'RootNode' => 'RootNode', - 'tmpRootPass' => 'q', -); - - define('UI_HANDLER', 'ui_handler.php'); define('UI_BROWSER', 'ui_browser.php'); define('UI_FORM_STANDARD_METHOD', 'POST'); @@ -135,19 +13,41 @@ define('UI_SEARCH_MAX_ROWS', 8); define('UI_SEARCH_MIN_ROWS', 2); define('UI_REGEX_URL', '/^(ht|f)tps?:\/\/[^ ]+$/'); define('UI_PL_ACCESSTOKEN_KEY', 'playlistToken'); -define('UI_SCRATCHPAD_KEY', 'djBagContents'); +define('UI_SCRATCHPAD_KEY', 'djBagContents'); define('UI_SCRATCHPAD_MAXLENGTH_KEY', 'djBagMaxlength'); #define('UI_SCRATCHPAD_REGEX', '/^[0-9a-f]{16}:[0-9]{4}-[0-9]{2}-[0-9]{2}$/'); -## session keys +## Session Keys define('UI_SCRATCHPAD_SESSNAME', 'SCRATCHPAD'); define('UI_STATIONINFO_SESSNAME', 'STATIONINFO'); define('UI_SEARCH_SESSNAME', 'L_SEARCH'); define('UI_PLAYLIST_SESSNAME', 'PLAYLIST'); define('UI_BROWSE_SESSNAME', 'L_BROWSE'); +## Metadata Keys define('UI_MDATA_KEY_TITLE', 'dc:title'); define('UI_MDATA_KEY_ARTIST', 'dc:creator'); define('UI_MDATA_KEY_DURATION', 'dcterms:extent'); define('UI_MDATA_KEY_URL', 'ls:url'); + +require_once dirname(__FILE__).'/../../storageServer/var/conf.php'; +## LS classes/functions ############################################# +require_once dirname(__FILE__).'/ui_base.inc.php'; +require_once dirname(__FILE__).'/ui_scratchpad.class.php'; +require_once dirname(__FILE__).'/ui_playlist.class.php'; +require_once dirname(__FILE__).'/ui_search.class.php'; +require_once dirname(__FILE__).'/ui_browse.class.php'; +require_once dirname(__FILE__).'/../../storageServer/var/GreenBox.php'; +require_once dirname(__FILE__).'/formmask/general.inc.php'; +require_once dirname(__FILE__).'/ui_calendar.class.php'; +require_once dirname(__FILE__).'/ui_scheduler.class.php'; + +## well known classes ############################################### +require_once 'DB.php'; +require_once 'HTML/QuickForm.php'; + +#PEAR::setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING); +#PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'errCallBack'); +PEAR::setErrorHandling(PEAR_ERROR_RETURN); +#PEAR::setErrorHandling(PEAR_ERROR_PRINT); ?> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/html/img/percentage_blue.png b/livesupport/modules/htmlUI/var/html/img/percentage_blue.png new file mode 100755 index 000000000..c69db6b4e Binary files /dev/null and b/livesupport/modules/htmlUI/var/html/img/percentage_blue.png differ diff --git a/livesupport/modules/htmlUI/var/html/img/percentage_red.png b/livesupport/modules/htmlUI/var/html/img/percentage_red.png new file mode 100755 index 000000000..7bfe457cb Binary files /dev/null and b/livesupport/modules/htmlUI/var/html/img/percentage_red.png differ diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php index df1b4b9ac..b7797af9d 100644 --- a/livesupport/modules/htmlUI/var/html/ui_handler.php +++ b/livesupport/modules/htmlUI/var/html/ui_handler.php @@ -222,17 +222,22 @@ switch($_REQUEST['act']){ $uiHandler->SCHEDULER->setReload(); break; - case "SCHEDULER.displaySchedule": - $uiHandler->SCHEDULER->displaySchedule(); + case "SCHEDULER.uploadPlaylistMethod": + $uiHandler->SCHEDULER->uploadPlaylistMethod($_REQUEST); $uiHandler->SCHEDULER->setReload(); break; default: - $_SESSION["alertMsg"] = tra("Unknown method: $1", $_REQUEST["act"]); - #header("Location: ".UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'); - die(); + $uiHandler->_retMsg("Unknown method: $1", $_REQUEST["act"]); + $uiHandler->redirUrl = UI_BROWSER; + if ($_REQUEST['was_popup']) + $uiHandler->redirUrl .= '?popup[]=_reload_parent&popup[]=_close'; } if ($uiHandler->alertMsg) $_SESSION['alertMsg'] = $uiHandler->alertMsg; #header('Location: '.$uiHandler->redirUrl); +if (ob_get_contents()) { + $ui_wait = 5; +} +ob_end_clean ?> - \ No newline at end of file + \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/templates/scheduler/calendar.tpl b/livesupport/modules/htmlUI/var/templates/scheduler/calendar.tpl index b7c378809..e9f5f4798 100755 --- a/livesupport/modules/htmlUI/var/templates/scheduler/calendar.tpl +++ b/livesupport/modules/htmlUI/var/templates/scheduler/calendar.tpl @@ -3,7 +3,7 @@ - + {foreach from=$SCHEDULER->Week item="_Weekday"} {/foreach} @@ -11,17 +11,19 @@ {foreach from=$SCHEDULER->Month item="_Day"} {if $_Day.isFirst} - + {/if} {if $_Day.isLast} diff --git a/livesupport/modules/htmlUI/var/templates/scheduler/input.tpl b/livesupport/modules/htmlUI/var/templates/scheduler/input.tpl index 34749d2e7..e0e25ecf8 100755 --- a/livesupport/modules/htmlUI/var/templates/scheduler/input.tpl +++ b/livesupport/modules/htmlUI/var/templates/scheduler/input.tpl @@ -12,7 +12,7 @@ {/if} - + {/foreach}
{$SCHEDULER->curr.year}-{$SCHEDULER->curr.month}-{$SCHEDULER->curr.day}
 {$_Weekday.label.short}
{$_Day.week}{$_Day.week} - {if $_Day.isEmpty} -   - {elseif $_Day.isSelected} - {$_Day.day} - {else} - {$_Day.day} - {/if} + {if $_Day.isEmpty} +
+ {elseif $_Day.isSelected} +
+ {else} +
+ {/if} + {$_Day.day} +
{$i.type}{$i.gunid}{$i.gunid}
diff --git a/livesupport/modules/htmlUI/var/templates/scheduler/main.tpl b/livesupport/modules/htmlUI/var/templates/scheduler/main.tpl index 6354b5708..cb50cdc31 100755 --- a/livesupport/modules/htmlUI/var/templates/scheduler/main.tpl +++ b/livesupport/modules/htmlUI/var/templates/scheduler/main.tpl @@ -4,7 +4,7 @@ - + {include file="scheduler/calendar.tpl"} diff --git a/livesupport/modules/htmlUI/var/templates/scheduler/month.tpl b/livesupport/modules/htmlUI/var/templates/scheduler/month.tpl index 6aea23fdd..0d1b13354 100755 --- a/livesupport/modules/htmlUI/var/templates/scheduler/month.tpl +++ b/livesupport/modules/htmlUI/var/templates/scheduler/month.tpl @@ -1,4 +1,4 @@ -{$SCHEDULER->buildMonth()} +{$SCHEDULER->buildMonth()} {$SCHEDULER->buildWeek()} Month View @@ -7,11 +7,13 @@ Month View {foreach from=$SCHEDULER->Week item="_Weekday"} - {$_Weekday.label.full} + {$_Weekday.label.full} {/foreach} {foreach from=$SCHEDULER->Month item="_Day"} + {assign var="percentage" value=$SCHEDULER->getDayUsagePercentage($_Day.year, $_Day.month, $_Day.day)} + {if $_Day.isFirst} {/if} @@ -19,7 +21,10 @@ Month View {if $_Day.isEmpty}   {else} - {$_Day.day} + + {$_Day.day} +
+ {/if} {if $_Day.isLast} diff --git a/livesupport/modules/htmlUI/var/templates/script/basics.js.tpl b/livesupport/modules/htmlUI/var/templates/script/basics.js.tpl index 7f3f7ef00..c9b04d74e 100755 --- a/livesupport/modules/htmlUI/var/templates/script/basics.js.tpl +++ b/livesupport/modules/htmlUI/var/templates/script/basics.js.tpl @@ -33,7 +33,7 @@ { var screenX; var screenY; - + url = url + '&was_popup=1'; screenX = (window.screenX + window.innerWidth/2 - width/2); screenY = (window.screenY + window.innerHeight/2 - height/2); arg = 'width='+width+', height='+height+', scrollbars=no, menubar=no, depend=yes, left='+screenX+', top='+screenY; @@ -44,6 +44,7 @@ function hpopup(url, name) //hidden popup! 'width=1, height=1' { + url = url + '&was_popup=1'; popupwin = window.open(url, name); //window.parent.focus(); } diff --git a/livesupport/modules/htmlUI/var/ui_base.inc.php b/livesupport/modules/htmlUI/var/ui_base.inc.php index 74fc4523b..0f043c26d 100644 --- a/livesupport/modules/htmlUI/var/ui_base.inc.php +++ b/livesupport/modules/htmlUI/var/ui_base.inc.php @@ -259,7 +259,8 @@ class uiBase if ($format=='text') { return "
".var_export($ia, TRUE)."
"; } elseif ($format=='xml') { - return ' + return '!!!XML IS DEPRICATED!!! + '.$this->_getFileTitle($id).' - '.date('H:i:s', round($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.')).' + '.$extent.' '; diff --git a/livesupport/modules/htmlUI/var/ui_browser_init.php b/livesupport/modules/htmlUI/var/ui_browser_init.php index e063c3ce0..65f54a263 100644 --- a/livesupport/modules/htmlUI/var/ui_browser_init.php +++ b/livesupport/modules/htmlUI/var/ui_browser_init.php @@ -3,37 +3,17 @@ session_start(); ## 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__).'/ui_scratchpad.class.php'; -require_once dirname(__FILE__).'/ui_playlist.class.php'; # -require_once dirname(__FILE__).'/ui_search.class.php'; -require_once dirname(__FILE__).'/ui_browse.class.php'; -require_once dirname(__FILE__).'/../../storageServer/var/GreenBox.php'; -require_once dirname(__FILE__).'/formmask/general.inc.php'; -require_once dirname(__FILE__).'/ui_calendar.class.php'; -require_once dirname(__FILE__).'/ui_scheduler.class.php'; + ## well known classes ############################################### require_once dirname(__FILE__).'/Smarty/libs/Smarty.class.php'; - -require_once 'DB.php'; -require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/Renderer/ArraySmarty.php'; -#PEAR::setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING); -#PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'errCallBack'); -PEAR::setErrorHandling(PEAR_ERROR_RETURN); -#PEAR::setErrorHandling(PEAR_ERROR_PRINT); - - ## initialize objects ############################################### $Smarty =& new Smarty; $uiBrowser =& new uiBrowser($config); -#$uiBase = new uiBase($config); $uiBase =& $uiBrowser; -#$uiScratchPad = new uiScratchPad(&$uiBrowser); - ## load Smarty+filters ############################################## require_once dirname(__FILE__).'/SmartyExtensions.inc.php'; @@ -59,8 +39,7 @@ $Smarty->assign('USER', array('sessid' => &$uiBrowser->sessid, )); $uiBrowser->loadStationPrefs($ui_fmask['stationPrefs']); $Smarty->assign('STATIONPREFS', $uiBrowser->STATIONPREFS); - - + ## retransfer incomplete formdata from SESSION to POST-data ######### if (is_array($_SESSION['retransferFormData'])){ foreach($_SESSION['retransferFormData'] as $k=>$v){ diff --git a/livesupport/modules/htmlUI/var/ui_calendar.class.php b/livesupport/modules/htmlUI/var/ui_calendar.class.php index 22f6f872d..41853d32c 100755 --- a/livesupport/modules/htmlUI/var/ui_calendar.class.php +++ b/livesupport/modules/htmlUI/var/ui_calendar.class.php @@ -26,6 +26,8 @@ class uiCalendar $this->Month[] = array( 'day' => $this->Base->_twoDigits($Day->thisDay()), 'week' => $this->_getWeekNr($Day), + 'month' => $this->Base->_twoDigits($Day->thisMonth()), + 'year' => $Day->thisYear(), 'isEmpty' => $Day->isEmpty(), 'isFirst' => $Day->isFirst(), 'isLast' => $Day->isLast(), @@ -52,6 +54,7 @@ class uiCalendar } + function buildDay() { if (is_array($this->Day)) return FALSE; @@ -66,6 +69,7 @@ class uiCalendar } + function buildHour() { require_once 'Calendar/Hour.php'; diff --git a/livesupport/modules/htmlUI/var/ui_handler.class.php b/livesupport/modules/htmlUI/var/ui_handler.class.php index 16f5bf229..5aecb78a2 100644 --- a/livesupport/modules/htmlUI/var/ui_handler.class.php +++ b/livesupport/modules/htmlUI/var/ui_handler.class.php @@ -175,9 +175,13 @@ class uiHandler extends uiBase { function transMData($id) { include dirname(__FILE__).'/formmask/metadata.inc.php'; - $this->gb->replaceMetadata($id, $this->_analyzeFile($id, 'xml'), 'string', $this->sessid); + #$this->gb->replaceMetadata($id, $this->_analyzeFile($id, 'xml'), 'string', $this->sessid); $ia = $this->gb->analyzeFile($id, $this->sessid); + $s = $ia['playtime_seconds']; + $extent = date('H:i:s', floor($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.')); + $this->_setMdataValue($id, UI_MDATA_KEY_DURATION, $extent); + foreach ($mask['pages'] as $key=>$val) { foreach ($mask['pages'][$key] as $k=>$v) { if ($v['id3'] != FALSE) { diff --git a/livesupport/modules/htmlUI/var/ui_handler_init.php b/livesupport/modules/htmlUI/var/ui_handler_init.php index 6ab5f71ad..e064d96cc 100644 --- a/livesupport/modules/htmlUI/var/ui_handler_init.php +++ b/livesupport/modules/htmlUI/var/ui_handler_init.php @@ -1,33 +1,13 @@ diff --git a/livesupport/modules/htmlUI/var/ui_scheduler.class.php b/livesupport/modules/htmlUI/var/ui_scheduler.class.php index d905dea59..f3710fd74 100755 --- a/livesupport/modules/htmlUI/var/ui_scheduler.class.php +++ b/livesupport/modules/htmlUI/var/ui_scheduler.class.php @@ -15,6 +15,7 @@ class uiScheduler extends uiCalendar $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; $this->uiCalendar(); + $this->initXmlRpc(); } @@ -27,23 +28,58 @@ class uiScheduler extends uiCalendar { extract($arr); if ($view) $this->curr['view'] = $view; + if ($year) $this->curr['year'] = $year; + if ($month) $this->curr['month']= $month; if ($day) $this->curr['day'] = $day; + if ($hour) $this->curr['hour'] = $hour; } - function displaySchedule() + function _datetime2timestamp($i) + { + $formatted = $i[0].$i[1].$i[2].$i[3].'-'.$i[6].$i[7].'-'.$i[4].$i[5].strrchr($i, 'T'); + #echo $formatted; + return strtotime($formatted); + } + + + function getDayUsagePercentage($year, $month, $day) + { + $duration = 0; + $date = $year.$month.$day; + $arr = $this->displayScheduleMethod($date.'T00:00:00', $date.'T23:59:59.999999'); + if (!count($arr)) { + return FALSE; + } + foreach ($arr as $val) { + $duration =+ $this->_datetime2timestamp($val['end'])-$this->_datetime2timestamp($val['start']); + + } + return $duration/86400*100; + } + + ## XML-RPC methods ############################################################################################ + function initXmlRpc() { include_once dirname(__FILE__).'/SchedulerPhpClient.class.php'; + $this->spc =& SchedulerPhpClient::factory($this->Base->dbc, $mdefs, $this->Base->config); + } - // scheduler client instantiation: - $spc =& SchedulerPhpClient::factory($this->Base->dbc, $mdefs, $this->Base->config); - // call of chosen function by name according to key values in $mdefs array: - // (for testing on storageServer XMLRPC I've changes confPrefix in - // SchedulerPhpClient constructor from 'scheduler' to 'storage' value) - $r = $spc->DisplayScheduleMethod($this->Base->sessid, '2005-01-01 00:00:00.000000', '2005-02-01 00:00:00.000000'); + function uploadPlaylistMethod(&$formdata) + { + $gunid = $formdata['gunid']; + $datetime = $formdate['datetime']; + + $r = $this->spc->UploadPlaylistMethod($this->Base->sessid, $gunid, '20050308T04:44:00.000000'.UI_TIMEZONE); var_dump($r); } + + function displayScheduleMethod($from, $to) + { + $r = $this->spc->displayScheduleMethod($this->Base->sessid, $from, $to); + return $r; + } } ?> diff --git a/livesupport/modules/htmlUI/var/ui_scratchpad.class.php b/livesupport/modules/htmlUI/var/ui_scratchpad.class.php index 641c2d00e..a2ab4db4f 100755 --- a/livesupport/modules/htmlUI/var/ui_scratchpad.class.php +++ b/livesupport/modules/htmlUI/var/ui_scratchpad.class.php @@ -66,7 +66,7 @@ class uiScratchPad function addItem($id) { if(!$this->Base->STATIONPREFS[UI_SCRATCHPAD_MAXLENGTH_KEY]) { - if ($this->verbose) $this->Base->_retMsg('ScratchPad length is not set in System Preferences, so it cannot be used.'); + if (!$this->verbose) $this->Base->_retMsg('ScratchPad length is not set in System Preferences, so it cannot be used.'); return false; }