From 61e1d47c97687521b1890de1854c5a1cda84bef1 Mon Sep 17 00:00:00 2001 From: sebastian Date: Wed, 27 Apr 2005 13:26:09 +0000 Subject: [PATCH] User management implemented --- .../htmlUI/var/SmartyExtensions.inc.php | 3 +- .../modules/htmlUI/var/formmask/subjects.php | 121 ++++++++ .../modules/htmlUI/var/html/ui_browser.php | 38 ++- .../modules/htmlUI/var/html/ui_handler.php | 37 ++- .../htmlUI/var/templates/masterpanel.tpl | 18 +- .../modules/htmlUI/var/templates/menu.tpl | 9 +- .../htmlUI/var/templates/playlist/editor.tpl | 6 +- .../var/templates/popup/SCHEDULER.addItem.tpl | 19 +- .../popup/SUBJECTS.confirmRemoveSubj.tpl | 11 + .../templates/scratchpad/actionhandler.tpl | 5 +- .../htmlUI/var/templates/scratchpad/main.tpl | 6 +- .../var/templates/script/alttext.js.tpl | 9 +- .../var/templates/script/contextmenu.js.tpl | 21 ++ .../modules/htmlUI/var/templates/subjects.tpl | 88 ------ .../var/templates/subjects/addSubjForm.tpl | 18 ++ .../var/templates/subjects/chgPasswd.tpl | 6 + .../htmlUI/var/templates/subjects/main.tpl | 18 ++ .../templates/subjects/manageGroupMember.tpl | 87 ++++++ .../var/templates/subjects/overview.tpl | 39 +++ .../templates/{ => system}/stationprefs.tpl | 0 .../modules/htmlUI/var/templates/userinfo.tpl | 6 +- .../modules/htmlUI/var/ui_base.inc.php | 5 +- .../modules/htmlUI/var/ui_browser.class.php | 92 ------- .../modules/htmlUI/var/ui_browser_init.php | 16 +- livesupport/modules/htmlUI/var/ui_conf.php | 1 + .../modules/htmlUI/var/ui_handler.class.php | 135 +-------- .../modules/htmlUI/var/ui_subjects.class.php | 260 ++++++++++++++++++ 27 files changed, 670 insertions(+), 404 deletions(-) create mode 100755 livesupport/modules/htmlUI/var/formmask/subjects.php create mode 100755 livesupport/modules/htmlUI/var/templates/popup/SUBJECTS.confirmRemoveSubj.tpl delete mode 100755 livesupport/modules/htmlUI/var/templates/subjects.tpl create mode 100755 livesupport/modules/htmlUI/var/templates/subjects/addSubjForm.tpl create mode 100755 livesupport/modules/htmlUI/var/templates/subjects/chgPasswd.tpl create mode 100755 livesupport/modules/htmlUI/var/templates/subjects/main.tpl create mode 100755 livesupport/modules/htmlUI/var/templates/subjects/manageGroupMember.tpl create mode 100755 livesupport/modules/htmlUI/var/templates/subjects/overview.tpl rename livesupport/modules/htmlUI/var/templates/{ => system}/stationprefs.tpl (100%) mode change 100755 => 100644 create mode 100755 livesupport/modules/htmlUI/var/ui_subjects.class.php diff --git a/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php b/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php index 3dc02e507..18929fe01 100644 --- a/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php +++ b/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php @@ -1,10 +1,11 @@ -register_object('UIBROWSER', $uiBrowser); $Smarty->register_object('BROWSE', $uiBrowser->BROWSE); $Smarty->register_object('SEARCH', $uiBrowser->SEARCH); $Smarty->assign_by_ref ('PL', $uiBrowser->PLAYLIST); $Smarty->assign_by_ref ('SCHEDULER', $uiBrowser->SCHEDULER); $Smarty->assign_by_ref ('SCRATCHPAD', $uiBrowser->SCRATCHPAD); +$Smarty->assign_by_ref ('SUBJECTS', $uiBrowser->SUBJECTS); $Smarty->register_function('str_repeat', 'S_str_repeat'); $Smarty->register_function('urlencode', 'S_urlencode'); diff --git a/livesupport/modules/htmlUI/var/formmask/subjects.php b/livesupport/modules/htmlUI/var/formmask/subjects.php new file mode 100755 index 000000000..532d9820f --- /dev/null +++ b/livesupport/modules/htmlUI/var/formmask/subjects.php @@ -0,0 +1,121 @@ + array( + array( + 'element' => 'act', + 'type' => 'hidden', + 'constant' => 'SUBJECTS.addSubj' + ), + array( + 'element' => 'login', + 'type' => 'text', + 'label' => 'Login', + 'required' => TRUE + ), + array( + 'element' => 'passwd', + 'type' => 'password', + 'label' => 'Password', + 'required' => TRUE + ), + array( + 'element' => 'passwd2', + 'type' => 'password', + 'label' => 'Repeat password', + 'required' => TRUE + ), + array( + 'element' => 'cancel', + 'type' => 'button', + 'label' => 'Cancel', + 'attributes'=> array('onClick' => 'location.href="'.UI_BROWSER.'?act=SUBJECTS"'), + 'groupit' => TRUE + ), + array( + 'element' => 'Submit', + 'type' => 'submit', + 'label' => 'Submit', + 'groupit' => TRUE + ), + array( + 'group' => array('cancel', 'Submit') + ) + ), + + 'addGroup' => array( + array( + 'element' => 'act', + 'type' => 'hidden', + 'constant' => 'SUBJECTS.addSubj' + ), + array( + 'element' => 'login', + 'type' => 'text', + 'label' => 'Groupname', + 'required' => TRUE + ), + array( + 'element' => 'cancel', + 'type' => 'button', + 'label' => 'Cancel', + 'attributes'=> array('onClick' => 'location.href="'.UI_BROWSER.'?act=SUBJECTS"'), + 'groupit' => TRUE + ), + array( + 'element' => 'Submit', + 'type' => 'submit', + 'label' => 'Submit', + 'groupit' => TRUE + ), + array( + 'group' => array('cancel', 'Submit') + ) + ), + + 'chgPasswd' => array( + array( + 'element' => 'act', + 'type' => 'hidden', + 'constant' => 'SUBJECTS.chgPasswd' + ), + array( + 'element' => 'login', + 'type' => 'hidden' + ), + 'oldpasswd' => array( + 'element' => 'oldpasswd', + 'type' => 'password', + 'label' => 'Old password', + 'required' => TRUE + ), + array( + 'element' => 'passwd', + 'type' => 'password', + 'label' => 'Password', + 'required' => TRUE + ), + array( + 'element' => 'passwd2', + 'type' => 'password', + 'label' => 'Repeat password', + 'required' => TRUE + ), + array( + 'element' => 'cancel', + 'type' => 'button', + 'label' => 'Cancel', + 'attributes'=> array('onClick' => 'location.href="'.UI_BROWSER.'?act=SUBJECTS"'), + 'groupit' => TRUE + ), + array( + 'element' => 'Submit', + 'type' => 'submit', + 'label' => 'Submit', + 'groupit' => TRUE + ), + array( + 'group' => array('cancel', 'Submit') + ) + ), +); +?> diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php index f4e13db7d..6a1191e45 100644 --- a/livesupport/modules/htmlUI/var/html/ui_browser.php +++ b/livesupport/modules/htmlUI/var/html/ui_browser.php @@ -81,6 +81,11 @@ if (is_array($_REQUEST['popup'])){ $Smarty->assign('scheduleId', $_REQUEST['scheduleId']); $Smarty->display('popup/SCHEDULER.removeItem.tpl'); break; + + case "SUBJECTS.confirmRemoveSubj": + $Smarty->assign('lgoin', $_REQUEST['login']); + $Smarty->display('popup/SUBJECTS.confirmRemoveSubj.tpl'); + break; } } die(); @@ -139,28 +144,6 @@ if ($uiBrowser->userid) { $Smarty->assign('showLibrary', TRUE); break; - case "subjects": - case "addUser": - case "addGroup": - $Smarty->assign('subjects', $uiBrowser->getSubjects()); - switch($_REQUEST['act']) { - case "addUser": $Smarty->assign('addSubjectForm', $uiBrowser->getAddSubjectForm($ui_fmask['addUser'])); break; - case "addGroup": $Smarty->assign('addSubjectForm', $uiBrowser->getAddSubjectForm($ui_fmask['addGroup'])); break; - } - $Smarty->assign('showSubjects', TRUE); - break; - - case "chgPasswd": - $Smarty->assign('chgPasswd', $uiBrowser->chgPasswd($_REQUEST['uid'], $ui_fmask['chgPasswd'])); - $Smarty->assign('showSubjects', TRUE); - break; - - case "groupMembers": - $Smarty->assign('groupMembers', $uiBrowser->groupMembers($uiBrowser->id)); - $Smarty->assign('addGroupMember', $uiBrowser->addGroupMember($uiBrowser->id)); - $Smarty->assign('showSubjects', TRUE); - break; - case "getFile": $Smarty->assign('fData', $uiBrowser->getFile($uiBrowser->id)); $Smarty->assign('showFile', TRUE); @@ -195,6 +178,17 @@ if ($uiBrowser->userid) { case "SCHEDULER": $Smarty->assign('showScheduler', TRUE); break; + + + case "SUBJECTS": + case "SUBJECTS.manageGroupMember": + case "SUBJECTS.addUser": + case "SUBJECTS.addGroup": + case "SUBJECTS.remSubj": + case "SUBJECTS.chgPasswd": + $Smarty->assign('showSubjects', TRUE); + $Smarty->assign('act', $_REQUEST['act']); + break; } if ($_REQUEST['act'] != 'SCHEDULER') diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php index fb313e44c..f2d3d81cd 100644 --- a/livesupport/modules/htmlUI/var/html/ui_handler.php +++ b/livesupport/modules/htmlUI/var/html/ui_handler.php @@ -73,22 +73,6 @@ switch($_REQUEST['act']){ $uiHandler->SCRATCHPAD->removeItems($uiHandler->id); break; - case "addUser": - $uiHandler->addSubj($_REQUEST, $ui_fmask["addUser"]); - break; - - case "addGroup": - $uiHandler->addSubj($_REQUEST, $ui_fmask["addGroup"]); - break; - - case "removeSubj": - $uiHandler->removeSubj($_REQUEST["login"]); - break; - - case "chgPasswd": - $uiHandler->chgPasswd($_REQUEST["uid"], $_REQUEST["oldpass"], $_REQUEST["pass"], $_REQUEST["pass2"]); - break; - case "addPerm": $uiHandler->addPerm($_REQUEST["subj"], $_REQUEST["permAction"], $uiHandler->id, $_REQUEST["allowDeny"]); break; @@ -97,12 +81,25 @@ switch($_REQUEST['act']){ $uiHandler->removePerm($_REQUEST["permid"], $_REQUEST["oid"]); break; - case "addGroupMember": - $uiHandler->addSubj2Group($_REQUEST); + ## SUBJECTS + case "SUBJECTS.addSubj": + $uiHandler->SUBJECTS->addSubj($_REQUEST); break; - case "removeGroupMember": - $uiHandler->removeGroupMember($_REQUEST); + case "SUBJECTS.removeSubj": + $uiHandler->SUBJECTS->removeSubj($_REQUEST); + break; + + case "SUBJECTS.addSubj2Group": + $uiHandler->SUBJECTS->addSubj2Group($_REQUEST); + break; + + case "SUBJECTS.removeSubjFromGr": + $uiHandler->SUBJECTS->removeSubjFromGr($_REQUEST); + break; + + case "SUBJECTS.chgPasswd": + $uiHandler->SUBJECTS->chgPasswd($_REQUEST); break; case "changeStationPrefs": diff --git a/livesupport/modules/htmlUI/var/templates/masterpanel.tpl b/livesupport/modules/htmlUI/var/templates/masterpanel.tpl index ecf6c6a98..cffd209f5 100755 --- a/livesupport/modules/htmlUI/var/templates/masterpanel.tpl +++ b/livesupport/modules/htmlUI/var/templates/masterpanel.tpl @@ -34,8 +34,8 @@ {include file="library/main.tpl"} {/if} - {if $showSubjects} - {include file="subjects.tpl"} + {if $showSubjects} + {include file="subjects/main.tpl"} {/if} {if $showFile} @@ -47,7 +47,7 @@ {/if} {if $changeStationPrefs} - {include file="stationprefs.tpl"} + {include file="system/stationprefs.tpl"} {/if} {if $PL_simpleManagement} @@ -55,13 +55,13 @@ {/if}
- {if $simpleSearchForm} - {include file="library/simpleSearchForm.tpl"} - {/if} + {if $simpleSearchForm} + {include file="library/simpleSearchForm.tpl"} + {/if} - {if $SCRATCHPAD} - {include file="scratchpad/main.tpl"} - {/if} + {if $SCRATCHPAD} + {include file="scratchpad/main.tpl"} + {/if}
{/if} diff --git a/livesupport/modules/htmlUI/var/templates/menu.tpl b/livesupport/modules/htmlUI/var/templates/menu.tpl index eb53a7368..503280832 100755 --- a/livesupport/modules/htmlUI/var/templates/menu.tpl +++ b/livesupport/modules/htmlUI/var/templates/menu.tpl @@ -1,7 +1,6 @@
diff --git a/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl b/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl index 2f4bb8b76..3ff86c404 100755 --- a/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl +++ b/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl @@ -5,7 +5,7 @@
 
 
-
+
 
@@ -27,7 +27,7 @@ {foreach from=$PL->getFlat() key='pos' item='i'} - + @@ -45,7 +45,7 @@ {/foreach} {if $n} - + diff --git a/livesupport/modules/htmlUI/var/templates/popup/SCHEDULER.addItem.tpl b/livesupport/modules/htmlUI/var/templates/popup/SCHEDULER.addItem.tpl index 75d524829..c8f74c8f0 100755 --- a/livesupport/modules/htmlUI/var/templates/popup/SCHEDULER.addItem.tpl +++ b/livesupport/modules/htmlUI/var/templates/popup/SCHEDULER.addItem.tpl @@ -32,18 +32,18 @@ function SCHEDULE_submit() function SCHEDULE_snap2Hour() { {/literal} - document.forms["schedule"].elements["time[H]"].value = {$SCHEDULER->scheduleAt.hour}; - document.forms["schedule"].elements["time[i]"].value = 0; - document.forms["schedule"].elements["time[s]"].value = 0; + document.forms["schedule"].elements["time[H]"].value = "{$SCHEDULER->scheduleAt.hour}"; + document.forms["schedule"].elements["time[i]"].value = "0"; + document.forms["schedule"].elements["time[s]"].value = "0"; {literal} } function SCHEDULE_snap2Prev() { {/literal} - document.forms["schedule"].elements["time[H]"].value = {$SCHEDULER->schedulePrev.hour}; - document.forms["schedule"].elements["time[i]"].value = {$SCHEDULER->schedulePrev.minute}; - document.forms["schedule"].elements["time[s]"].value = {$SCHEDULER->schedulePrev.second}; + document.forms["schedule"].elements["time[H]"].value = "{$SCHEDULER->schedulePrev.hour}"; + document.forms["schedule"].elements["time[i]"].value = "{$SCHEDULER->schedulePrev.minute}"; + document.forms["schedule"].elements["time[s]"].value = "{$SCHEDULER->schedulePrev.second}"; {literal} } @@ -79,13 +79,6 @@ function SCHEDULE_selectedGunid() var arr = document.forms["schedule"].elements["gunid_duration"].value.split("|"); return arr[0]; } -/* -date1 = new Date("january 01, 1970 00:00:10"); -date2 = new Date("january 01, 1970 00:00:33"); -date3 = new Date(); -date3.setTime(date1.getTime() + date2.getTime()); -alert(date3.getSeconds()); -*/ {/literal} diff --git a/livesupport/modules/htmlUI/var/templates/popup/SUBJECTS.confirmRemoveSubj.tpl b/livesupport/modules/htmlUI/var/templates/popup/SUBJECTS.confirmRemoveSubj.tpl new file mode 100755 index 000000000..f698b1135 --- /dev/null +++ b/livesupport/modules/htmlUI/var/templates/popup/SUBJECTS.confirmRemoveSubj.tpl @@ -0,0 +1,11 @@ +{include file="popup/header.tpl"} + +
+{tra 0='Are you sure to remove "$1"?' 1=$_REQUEST.login} +

+ + +
+ + + diff --git a/livesupport/modules/htmlUI/var/templates/scratchpad/actionhandler.tpl b/livesupport/modules/htmlUI/var/templates/scratchpad/actionhandler.tpl index 3a8f9d1cb..9219891c9 100755 --- a/livesupport/modules/htmlUI/var/templates/scratchpad/actionhandler.tpl +++ b/livesupport/modules/htmlUI/var/templates/scratchpad/actionhandler.tpl @@ -25,12 +25,11 @@ onClick="hidealttextnow(); return contextmenu('{$i.id}' {if $_PL_activeId} {if $_PL_activeId == $i.id} , 'PL.release' - {elseif $PL->isAvailable($i.id) == TRUE} + {elseif $PL->isAvailable($i.id) == true} , 'PL.addItem', 'delete' {/if} - {elseif $PL->isAvailable($i.id) == TRUE} + {elseif $PL->isAvailable($i.id) == true} , 'PL.activate', 'PL.create', 'delete' {/if} {/if} )" - diff --git a/livesupport/modules/htmlUI/var/templates/scratchpad/main.tpl b/livesupport/modules/htmlUI/var/templates/scratchpad/main.tpl index d82812f49..375320ed4 100755 --- a/livesupport/modules/htmlUI/var/templates/scratchpad/main.tpl +++ b/livesupport/modules/htmlUI/var/templates/scratchpad/main.tpl @@ -24,7 +24,7 @@ {assign var="_duration" value=$i.duration} diff --git a/livesupport/modules/htmlUI/var/templates/script/alttext.js.tpl b/livesupport/modules/htmlUI/var/templates/script/alttext.js.tpl index ce15da1f8..3225241d7 100755 --- a/livesupport/modules/htmlUI/var/templates/script/alttext.js.tpl +++ b/livesupport/modules/htmlUI/var/templates/script/alttext.js.tpl @@ -2,8 +2,9 @@
##Fade## {$i.fadein_ms|string_format:"%d"} ms
##Fade## {$i.fadeout_ms|string_format:"%d"} ms
- {if $i.type == "playlist"} + {if $i.type|lower == "playlist"} {if $PL->isAvailable($i.id) == FALSE}
{else} @@ -35,10 +35,10 @@ {else}
{/if} - {$i.title|truncate:12} + {$i.title|truncate:12:'...':true}
{else} - {$i.title|truncate:12} + {$i.title|truncate:12:'...':true} {/if} {* on some reason object call doesn´t like usage of array *}
{niceTime in=$_duration}