Added new (missing) template for admin area + continued a bit with ext-surfbar
authorRoland Haeder <roland@mxchange.org>
Thu, 28 May 2015 21:59:24 +0000 (23:59 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 28 May 2015 21:59:24 +0000 (23:59 +0200)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
inc/extensions/surfbar/mode-setup.php
inc/language/surfbar_de.php
inc/modules/admin/what-list_surfbar_packages.php
inc/template-functions.php
templates/de/html/admin/admin_add_surfbar_package.tpl [new file with mode: 0644]

index b252e7f..c15d4bc 100644 (file)
@@ -58,7 +58,7 @@ PRIMARY KEY (`url_id`),
 UNIQUE INDEX `userid_url` (`url_userid`, `url`),
 INDEX `status_userid` (`url_status`, `url_userid`),
 INDEX (`url_package_id`)",
-                       'Visitor add-on URLs');
+                       'Visitor add-on URLs');
 
                // Booking packages for members
                addDropTableSql('surfbar_packages');
@@ -70,7 +70,7 @@ INDEX (`url_package_id`)",
 `package_points_reward` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
 PRIMARY KEY (`package_id`),
 UNIQUE INDEX `package` (`package_reload`, `package_waiting`)",
-                       'Booking packages');
+                       'Vistor-addon - booking packages');
 
                // Reload locks
                addDropTableSql('surfbar_locks');
@@ -82,7 +82,7 @@ UNIQUE INDEX `package` (`package_reload`, `package_waiting`)",
 PRIMARY KEY (`locks_id`),
 UNIQUE INDEX `userid_url` (`locks_userid`, `locks_url_id`),
 INDEX (`locks_url_id`)",
-                       'Vistor-addon reload locks');
+                       'Vistor-addon reload locks');
 
                // Visitor add-on salts
                addDropTableSql('surfbar_salts');
@@ -94,7 +94,7 @@ INDEX (`locks_url_id`)",
 PRIMARY KEY (`salts_id`),
 UNIQUE INDEX `salts_userid_url` (`salts_userid`, `salts_url_id`),
 INDEX (`salts_url_id`)",
-                       'Visitor add-on last used salts');
+                       'Visitor add-on last used salts');
 
                // Statistics
                addDropTableSql('surfbar_stats');
@@ -107,7 +107,7 @@ INDEX (`salts_url_id`)",
 PRIMARY KEY (`stats_id`),
 UNIQUE INDEX `userid_url` (`stats_userid`, `stats_url_id`),
 INDEX (`stats_url_id`)",
-                       'Visitor add-on Statistics');
+                       'Visitor add-on - statistics');
 
                // Member actions pending on status
                addDropTableSql('surfbar_actions');
@@ -118,7 +118,7 @@ INDEX (`stats_url_id`)",
 `actions_new_status` ENUM('PENDING', 'ACTIVE', 'LOCKED', 'STOPPED', 'REJECTED', 'DELETED', 'MIGRATED', 'DEPLETED') NULL DEFAULT NULL,
 PRIMARY KEY (`actions_id`),
 UNIQUE INDEX `status_action` (`actions_status`, `actions_action`)",
-                       'Visitor add-on Member Actions');
+                       'Visitor add-on Member Actions');
 
                // Member actions
                addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('PENDING', 'RETREAT', 'DELETED')");
index 42767e0..c89e7b9 100644 (file)
@@ -78,6 +78,7 @@ addMessages(array(
        'ADMIN_ADD_SURFBAR_URL_TITLE' => "URL im Besuchertausch hinzuf&uuml;gen",
        'ADMIN_LIST_SURFBAR_ACTIONS_TITLE' => "Mitglieder-Aktionen des Besuchertausches auflisten",
        'ADMIN_EDIT_SURFBAR_ACTIONS_TITLE' => "Mitglieder-Aktionen &auml;ndern",
+       'ADMIN_ADD_SURFBAR_PACKAGE_TITLE' => "Neues Buchungspaket hinzuf&uuml;gen",
 
        // Admin submit buttons
        'ADMIN_SURFBAR_EDIT_URL_SUBMIT' => "URLs &auml;ndern",
@@ -93,6 +94,7 @@ addMessages(array(
        'ADMIN_SURFBAR_ADD_URL_SUBMIT' => "URL hinzuf&uuml;gen",
        'ADMIN_EDIT_SURFBAR_ACTIONS_SUBMIT' => "Mitgliedsaktionen editieren",
        'ADMIN_CHANGE_SURFBAR_ACTIONS_SUBMIT' => "Mitglieder-Aktionen &auml;ndern",
+       'ADMIN_SURFBAR_ADD_PACKAGE_SUBMIT' => "Buchungspaket hinzuf&uuml;gen",
 
        // General admin text
        'ADMIN_ENTER_SURFBAR_URL' => "URL eingeben:",
@@ -133,6 +135,11 @@ addMessages(array(
        'ADMIN_CHANGE_SURFBAR_ACTIONS_ACTION' => "Mitglieder-Aktion &auml;ndern:",
        'ADMIN_CHANGE_SURFBAR_ACTIONS_NEW_STATUS' => "Neuen URL-Status &auml;ndern:",
        'ADMIN_SURFBAR_ACTIONS_ID' => "Aktions-Id:",
+       'ADMIN_SELECT_SURFBAR_PACKAGE_RELOAD' => "Reload-Sperre einstellen:",
+       'ADMIN_SELECT_SURFBAR_PACKAGE_WAITING' => "Mindestverweildauer einstellen:",
+       'ADMIN_ENTER_SURFBAR_PACKAGE_POINTS_COSTS' => "Kosten in {?POINTS?} pro Klick:",
+       'ADMIN_ENTER_SURFBAR_PACKAGE_POINTS_REWARD' => "Verg&uuml;tung in {?POINTS?} pro Klick:",
+       'ADMIN_SURFBAR_PACKAGES_NO_SELECTIONS' => "Sie haben keine Auswahlen an Buchungspaketen gemacht.",
 
        // Admin - surfbar packages
        'ADMIN_SURFBAR_PACKAGES_404' => "Sie haben noch keine Buchungspakete erstellt. Solange k&ouml;nnen Ihre Mitglieder keine URLs im Besuchertausch buchen.",
index 8c56971..67eb957 100644 (file)
@@ -47,7 +47,10 @@ addYouAreHereLink('admin', __FILE__);
 $show = TRUE;
 
 // Check for 'package_id' element
-if ((countRequestPost() > 0) && (!ifPostContainsSelections('package_id'))) {
+if (isFormSent('add')) {
+       // Add new entry
+       die('Unfinished!');
+} elseif ((countRequestPost() > 0) && (!ifPostContainsSelections('package_id'))) {
        // Not found so output message
        displayMessage('{--ADMIN_SURFBAR_PACKAGES_NO_SELECTIONS--}');
 
@@ -86,7 +89,10 @@ if ($show === FALSE) {
 doGenericXmlTemplateCallback('admin_list_surfbar_packages');
 
 // Load 'add' template
-loadTemplate('admin_add_surfbar_package');
+loadTemplate('admin_add_surfbar_package', FALSE, array(
+       'surfbar_package_reload'  => createTimeSelections(60, 'surfbar_package_reload', 'Dhms', 'center', FALSE, TRUE),
+       'surfbar_package_waiting' => createTimeSelections(10, 'surfbar_package_reload', 'ms'  , 'center', FALSE, TRUE),
+));
 
 // [EOF]
 ?>
index d4bd635..6844430 100644 (file)
@@ -780,7 +780,7 @@ function compileRawCode ($code, $full = TRUE, $compileCode = TRUE) {
 }
 
 //
-function addSelectionBox ($type, $default, $prefix = '', $id = NULL, $class = 'form_select') {
+function addSelectionBox ($type, $default, $prefix = '', $id = NULL, $class = 'form_select', $allSteps = FALSE) {
        $OUT = '';
 
        if ($type == 'yn') {
@@ -880,7 +880,16 @@ function addSelectionBox ($type, $default, $prefix = '', $id = NULL, $class = 'f
 
                case 'mi': // Minutes
                case 'se': // Seconds
-                       for ($idx = 0; $idx <= 59; $idx+=5) {
+                       // Default is 5 minutes/seconds step
+                       $step = 5;
+
+                       // All steps?
+                       if ($allSteps === TRUE) {
+                               // Then all steps
+                               $step = 1;
+                       } // END - if
+
+                       for ($idx = 0; $idx <= 59; $idx += $step) {
                                $padded = padLeftZero($idx, 2);
                                $OUT .= '<option value="' . $padded . '"';
                                if ($default == $padded) $OUT .= ' selected="selected"';
@@ -960,7 +969,7 @@ function generateImageOrCode ($img_code, $headerSent = TRUE) {
 }
 
 // Create selection box or array of splitted timestamp
-function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = 'center', $asArray = FALSE) {
+function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = 'center', $asArray = FALSE, $allSteps = FALSE) {
        // Do not continue if ONE_DAY is absend
        if (!isConfigEntrySet('ONE_DAY')) {
                // Abort here
@@ -1076,7 +1085,7 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align =
                        if (isInString($unit, $display) || (empty($display))) {
                                // Generate year selection
                                $OUT .= '<td align="center">';
-                               $OUT .= addSelectionBox($field, $data[$unit], $prefix, NULL, 'mini_select');
+                               $OUT .= addSelectionBox($field, $data[$unit], $prefix, NULL, 'mini_select', $allSteps);
                                $OUT .= '</td>';
                        } else {
                                $OUT .= '<input type="hidden" name="' . $prefix . '_' . $field . '" value="0" />';
diff --git a/templates/de/html/admin/admin_add_surfbar_package.tpl b/templates/de/html/admin/admin_add_surfbar_package.tpl
new file mode 100644 (file)
index 0000000..46c8d6e
--- /dev/null
@@ -0,0 +1,34 @@
+<div align="center">
+{%form,formMethodPost=modules.php?module=admin&amp;what=list_surfbar_packages%}
+<div class="table dashed">
+       <div class="table_header bottom">
+               <strong>{--ADMIN_ADD_SURFBAR_PACKAGE_TITLE--}</strong>
+       </div>
+
+       <div class="admin_input" align="center">
+               <label for="url">{--ADMIN_SELECT_SURFBAR_PACKAGE_RELOAD--}</label>
+               $content[surfbar_package_reload]
+       </div>
+
+       <div class="admin_input" align="center">
+               <label for="url">{--ADMIN_SELECT_SURFBAR_PACKAGE_WAITING--}</label>
+               $content[surfbar_package_waiting]
+       </div>
+
+       <div class="admin_input" align="center">
+               <label for="url">{--ADMIN_ENTER_SURFBAR_PACKAGE_POINTS_COSTS--}</label>
+               <input type="text" class="form_field" name="package_points_costs" size="10" maxlength="20" value="0" /> ({?POINTS?})
+       </div>
+
+       <div class="admin_input bottom" align="center">
+               <label for="url">{--ADMIN_ENTER_SURFBAR_PACKAGE_POINTS_REWARD--}</label>
+               <input type="text" class="form_field" name="package_points_reward" size="10" maxlength="20" value="0" /> ({?POINTS?})
+       </div>
+
+       <div align="center" class="table_footer">
+               <input type="reset" class="form_reset" value="{--CLEAR_FORM--}" />
+               <input type="submit" class="form_submit" name="add" value="{--ADMIN_SURFBAR_ADD_PACKAGE_SUBMIT--}" />
+       </div>
+</div>
+{%form_close%}
+</div>