Browse Source

Fix dev server url generation

tags/v1.3^2
Teknikode 5 years ago
parent
commit
1198b4a203
5 changed files with 59 additions and 8 deletions
  1. 0
    0
      admin/add_user_role.php
  2. 5
    3
      admin/get_user.php
  3. 22
    0
      includes/common.php
  4. 29
    2
      templates/default/js/admin.js
  5. 3
    3
      web.config

+ 0
- 0
admin/add_user_role.php View File


+ 5
- 3
admin/get_user.php View File

@@ -40,25 +40,27 @@ if(isset($_POST))
}
?>
</div>
<br />
<div class="row">
<div class="col-sm-10">
<select class="form-control" name="role_select_<?php echo $user->id; ?>" id="role_select_<?php echo $user->id; ?>">
<select class="form-control selectpicker" name="role_select_<?php echo $user->id; ?>" id="role_select_<?php echo $user->id; ?>">
<?php
$roles = Role::getRoles($db);
foreach ($roles as $role)
{
echo "<option>".$role['role_name']."</option>";
echo "<option value=\"".$role['role_name']."\">".$role['role_name']."</option>";
}
?>
</select>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-default" id="<?php echo $user->id; ?>">Add Role</button>
<button type="button" class="btn btn-default add_user_role" id="<?php echo $user->id; ?>">Add Role</button>
</div>
</div>
</div>
</div>
<hr />
<?php
}
}

+ 22
- 0
includes/common.php View File

@@ -15,6 +15,18 @@ function get_page_url($page, $CONF, $full = true)
$cur_sub = get_subdomain($CONF);
$full_url = get_http($CONF).$cur_sub.".".$CONF['host']."/".$page;
break;
case 'get':
if (isset($_GET['site_page']))
{
$cur_page = $_GET['site_page'];
}
else
{
$cur_page = $CONF['default_page'];
}
$cur_sub = get_subdomain($CONF);
$full_url = get_http($CONF).$cur_sub.".".$CONF['host']."/".$cur_page;
break;
}
return $full_url;
}
@@ -86,6 +98,16 @@ function get_active($page, $CONF)
case 'page':
$cur_page = get_page();
break;
case 'get':
if (isset($_GET['site_page']))
{
$cur_page = $_GET['site_page'];
}
else
{
$cur_page = $CONF['default_page'];
}
break;
}
if ($cur_page == $page)
{

+ 29
- 2
templates/default/js/admin.js View File

@@ -7,13 +7,40 @@ function update_user_list(search)
success: function(html)
{
$(".user_list").html(html);
//linkAddRole('.add_role');
//linkRemoveRole('.remove_role');
//linkUserAddRole('.add_user_role');
//linkUserRemoveRole('.remove_role');
//linkUserDelete('.user_delete');
}
});
}

function linkUserAddRole(selector)
{
$(selector).click(function() {
var object = $(this);
user_id=encodeURIComponent(object.attr("id"));
var selectObj = $('#role_select_'+user_id);
role=encodeURIComponent(selectObj.options[selectObj.selectedIndex].value);
$.ajax({
type: "POST",
url: "../../../add_user_role.php",
data: "id="+user_id+"&role="+role,
success: function(html)
{
if(!html)
{
update_user_list($('#userSearch').val());
}
else
{
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'+html+'</div>');
}
}
});
});
}

function linkUserUpdate(selector)
{
$(selector).click(function() {

+ 3
- 3
web.config View File

@@ -3,16 +3,16 @@
<system.webServer>
<rewrite>
<rules>
<rule name="RedirectDefaultPage" enabled="true" stopProcessing="true">
<rule name="RedirectDefaultPage" enabled="true" stopProcessing="false">
<match url="^(.+)$" negate="true" />
<action type="Redirect" url="home/" />
</rule>
<rule name="RewriteSubMainURL" enabled="false" stopProcessing="false">
<rule name="RewriteSubMainURL" enabled="true" stopProcessing="false">
<match url="^([^/]+)/(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="{R:2}" appendQueryString="false" />
<action type="Rewrite" url="{R:2}?site_page={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>

Loading…
Cancel
Save