1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-14 01:22:13 +02:00

eUrl admin rework

This commit is contained in:
Cameron 2013-02-26 01:30:13 -08:00
parent 010d9ba9bd
commit 3d99e66961
18 changed files with 187 additions and 60 deletions

View File

@ -233,8 +233,17 @@ class eurl_admin_ui extends e_admin_controller_ui
<colgroup>
<col class='col-label' />
<col class='col-control' />
<col class='col-control' />
</colgroup>
<thead>
<tr>
<th>".LAN_TYPE."</th>
<th>".LAN_URL."</th>
</tr>
</thead>
<tbody>
";
@ -375,6 +384,46 @@ class eurl_admin_form_ui extends e_admin_form_ui
{
return $this->getSettings();
}
public function moreInfo($title,$info)
{
$tp = e107::getParser();
$id = 'eurl_'.$this->name2id($title);
$text .= "<a data-toggle='modal' href='#".$id."' data-cache='false' data-target='#".$id."' class='e-tip' title='".LAN_MOREINFO."'>";
$text .= $title;
$text .= '</a>';
$text .= '
<div id="'.$id.'" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4>'.$tp->toHtml($title,false,'TITLE').'</h4>
</div>
<div class="modal-body">
<p>';
$text .= $info;
$text .= '</p>
</div>
<div class="modal-footer">
<a href="#" data-dismiss="modal" class="btn btn-primary">Close</a>
</div>
</div>';
return $text;
}
public function moduleRows($data)
{
@ -389,16 +438,29 @@ class eurl_admin_form_ui extends e_admin_form_ui
";
}
$PLUGINS_DIRECTORY = e107::getFolder("PLUGINS");
$srch = array("{SITEURL}","{e_PLUGIN_ABS}");
$repl = array(SITEURL,SITEURL.$PLUGINS_DIRECTORY);
foreach ($data as $obj)
{
$admin = $obj->config->admin();
$section = vartrue($admin['labels'], array());
$text .= "
<tr>
<td>".vartrue($section['name'], eHelper::labelize($obj->module))."</td>
<td>
";
$rowspan = count($obj->locations)+1;
$module = $obj->module;
/*
$info .= "
<tr>
<td rowspan='$rowspan'><a class='e-tip' style='display:block' title='".LAN_EURL_LOCATION.$path."'>
".vartrue($section['name'], eHelper::labelize($obj->module))."
</a></td>
</tr>
";
*/
$opt = "";
$info = "<table class='table table-striped'>";
foreach ($obj->locations as $index => $location)
{
$objSub = $obj->defaultLocation != $location ? eDispatcher::getConfigObject($obj->module, $location) : false;
@ -410,36 +472,68 @@ class eurl_admin_form_ui extends e_admin_form_ui
elseif($obj->defaultLocation != $location) $section = array();
$id = 'eurl-'.str_replace('_', '-', $obj->module).'-'.$index;
$module = $obj->module;
$checked = varset($obj->current[$module]) == $location ? ' checked="checked"' : '';
$path = eDispatcher::getConfigPath($module, $location, false);
if(!is_readable($path)) $path = str_replace('/url.php', '/', $tp->replaceConstants(eDispatcher::getConfigPath($module, $location, true), true)).' <em>('.LAN_EURL_LOCATION_NONE.')</em>';
else $path = $tp->replaceConstants(eDispatcher::getConfigPath($module, $location, true), true);
if(!is_readable($path))
{
$path = str_replace('/url.php', '/', $tp->replaceConstants(eDispatcher::getConfigPath($module, $location, true), true)).' <em>('.LAN_EURL_LOCATION_NONE.')</em>';
$diz = LAN_EURL_DEFAULT;
}
else
{
$path = $tp->replaceConstants(eDispatcher::getConfigPath($module, $location, true), true);
$diz = (basename($path) != 'url.php' ) ? LAN_EURL_FRIENDLY : LAN_EURL_DEFAULT;
}
$label = vartrue($section['label'], $index == 0 ? LAN_EURL_DEFAULT : eHelper::labelize(ltrim(strstr($location, '/'), '/')));
$cssClass = $checked ? 'e-showme' : 'e-hideme';
$cssClass = 'e-hideme'; // always hidden for now, some interface changes could come after pre-alpha
// XXX use e_form
$text .= "
<a href='#{$id}-info' class='e-expandit' title='".LAN_EURL_INFOALT."'><img src='".e_IMAGE_ABS."admin_images/info_16.png' class='icon' alt='' /></a>
<input type='radio' class='radio' id='{$id}' name='eurl_config[$module]' value='{$location}'{$checked} /><label for='{$id}'>".$label."</label>
<div class='{$cssClass}' id='{$id}-info'>
<div class='indent'>
<strong>".LAN_EURL_LOCATION."</strong> ".$path."
<p>".vartrue($section['description'], LAN_EURL_PROFILE_INFO)."</p>
</div>
</div>
<div class='spacer'><!-- --></div>
";
}
$text .= "
$exampleUrl = array();
foreach($section['examples'] as $ex)
{
$exampleUrl[] = str_replace($srch,$repl,$ex);
}
if(strpos($path,'noid')!==false)
{
// $exampleUrl .= " &nbsp; &Dagger;"; //XXX Add footer - denotes more CPU required. ?
}
$selected = varset($obj->current[$module]) == $location ? "selected='selected'" : '';
$opt .= "<option value='{$location}' {$selected} >".$diz.": ".$exampleUrl[0]."</option>";
$info .= "<tr><td>".$label."
</td>
</tr>
";
<td><strong>".LAN_EURL_LOCATION."</strong> ".$path."
<p>".vartrue($section['description'], LAN_EURL_PROFILE_INFO)."</p><small>".implode("<br />", $exampleUrl)."</small></td></tr>
";
}
$info .= "</table>";
$title = vartrue($section['name'], eHelper::labelize($obj->module));
$text .= "
<tr>
<td>".$this->moreInfo($title, $info)."</td>
<td><select name='eurl_config[$module]' class='span6 tbox'>".$opt."</select></td>
</tr>";
}
/*
For Miro - intuitive interface example. All configs are contained within one e_url.php file.
Root namespacing automatically calculated based on selection.

View File

@ -60,6 +60,7 @@ class core_news_sef_full_url extends eUrlConfig
'name' => LAN_EURL_CORE_NEWS, // Module name
'label' => LAN_EURL_NEWS_REWRITEF_LABEL, // Current profile name
'description' => LAN_EURL_NEWS_REWRITEF_DESCR, //
'examples' => array("{SITEURL}news/news-category/news-title","{SITEURL}news/category/new-category")
),
'form' => array(), // Under construction - additional configuration options

View File

@ -244,6 +244,7 @@ class core_news_sef_noid_url extends eUrlConfig
'name' => LAN_EURL_CORE_NEWS, // Module name
'label' => LAN_EURL_NEWS_REWRITE_LABEL, // Current profile name
'description' => LAN_EURL_NEWS_REWRITE_DESCR, //
'examples' => array("{SITEURL}news/news-title")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -137,6 +137,7 @@ class core_news_sef_url extends eUrlConfig
'name' => LAN_EURL_CORE_NEWS, // Module name
'label' => LAN_EURL_NEWS_REWRITEX_LABEL, // Current profile name
'description' => LAN_EURL_NEWS_REWRITEX_DESCR, //
'examples' => array('{SITEURL}news/1/news-title')
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -175,8 +175,9 @@ class core_news_url extends eUrlConfig
static $admin = array(
'labels' => array(
'name' => LAN_EURL_CORE_NEWS, // Module name
'label' => LAN_EURL_NEWS_DEFAULT_LABEL, // Current profile name
'description' => LAN_EURL_NEWS_DEFAULT_DESCR, //
'label' => LAN_EURL_DEFAULT, // Current profile name
'description' => LAN_EURL_LEGACY, //
'examples' => array("{SITEURL}news.php?extend.1")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -53,6 +53,7 @@ class core_page_sef_noid_url extends eUrlConfig
'name' => LAN_EURL_CORE_PAGE, // Module name
'label' => LAN_EURL_PAGE_SEFNOID_LABEL, // Current profile name
'description' => LAN_EURL_PAGE_SEFNOID_DESCR, //
'examples' => array("{SITEURL}page/page-title")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -52,6 +52,7 @@ class core_page_sef_url extends eUrlConfig
'name' => LAN_EURL_CORE_PAGE, // Module name
'label' => LAN_EURL_PAGE_SEF_LABEL, // Current profile name
'description' => LAN_EURL_PAGE_SEF_DESCR, //
'examples' => array("{SITEURL}page/1/page-name")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -62,8 +62,9 @@ class core_page_url extends eUrlConfig
static $admin = array(
'labels' => array(
'name' => LAN_EURL_CORE_PAGE, // Module name
'label' => LAN_EURL_PAGE_DEFAULT_LABEL, // Current profile name
'description' => LAN_EURL_PAGE_DEFAULT_DESCR, //
'label' => LAN_EURL_DEFAULT, // Current profile name
'description' => LAN_EURL_LEGACY, //
'examples' => array("{SITEURL}page.php?1","{SITEURL}page.php?id=1")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -39,6 +39,7 @@ class core_search_rewrite_url extends eUrlConfig
'name' => LAN_EURL_CORE_SEARCH, // Module name
'label' => LAN_EURL_SEARCH_REWRITE_LABEL, // Current profile name
'description' => LAN_EURL_SEARCH_REWRITE_DESCR, //
'examples' => array("{SITEURL}search/")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -53,8 +53,9 @@ class core_search_url extends eUrlConfig
static $admin = array(
'labels' => array(
'name' => LAN_EURL_CORE_SEARCH, // Module name
'label' => LAN_EURL_SEARCH_DEFAULT_LABEL, // Current profile name
'description' => LAN_EURL_SEARCH_DEFAULT_DESCR, //
'label' => LAN_EURL_DEFAULT, // Current profile name
'description' => LAN_EURL_LEGACY, //
'examples' => array("{SITEURL}search.php")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -42,6 +42,7 @@ class core_system_rewrite_url extends eUrlConfig
'name' => LAN_EURL_CORE_SYSTEM, // Module name
'label' => LAN_EURL_SYSTEM_REWRITE_LABEL, // Current profile name
'description' => LAN_EURL_SYSTEM_REWRITE_DESCR, //
'examples' => array("{SITEURL}system/error404")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -33,6 +33,7 @@ class core_system_url extends eUrlConfig
'name' => LAN_EURL_CORE_SYSTEM, // Module name
'label' => LAN_EURL_SYSTEM_DEFAULT_LABEL, // Current profile name
'description' => LAN_EURL_SYSTEM_DEFAULT_DESCR, //
'examples' => array("{SITEURL}?route=system/error/notfound")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -63,6 +63,7 @@ class core_user_rewrite_url extends eUrlConfig
'name' => LAN_EURL_CORE_USER, // Module name
'label' => LAN_EURL_USER_REWRITE_LABEL, // Current profile name
'description' => LAN_EURL_USER_REWRITE_DESCR, //
'examples' => array("{SITEURL}user/UserDisplayName")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -104,9 +104,10 @@ class core_user_url extends eUrlConfig
// static may be used for performance
static $admin = array(
'labels' => array(
'name' => LAN_EURL_CORE_USER, // Module name
'label' => LAN_EURL_USER_DEFAULT_LABEL, // Current profile name
'description' => LAN_EURL_USER_DEFAULT_DESCR, //
'name' => LAN_EURL_CORE_USER, // Module name
'label' => LAN_EURL_DEFAULT, // Current profile name
'description' => LAN_EURL_LEGACY, //
'examples' => array("{SITEURL}user.php?id.1")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -70,49 +70,66 @@ define("LAN_EURL_UC", "Under Construction");
define("LAN_EURL_CORE_MAIN", "Site Root Namespace - alias not in use.");
define("LAN_EURL_DEFAULT", "Default");
define("LAN_EURL_FRIENDLY", "Friendly");
define("LAN_EURL_LEGACY", "Legacy direct URLs.");
define("LAN_EURL_REWRITE_LABEL", "Friendly URLs");
define("LAN_EURL_REWRITE_DESCR", "Search engine and user friendly URLs.");
// News
define("LAN_EURL_CORE_NEWS", "News");
define("LAN_EURL_NEWS_DEFAULT_LABEL", "Default");
define("LAN_EURL_NEWS_DEFAULT_DESCR", "Legacy direct URLs. Examples: <br />http://yoursite.com/news.php<br />http://yoursite.com/news.php?extend.1 <em>(view news item)</em>");
define("LAN_EURL_NEWS_REWRITE_LABEL", "Friendly URLs without ID (no performance, more friendly)");
define("LAN_EURL_NEWS_REWRITE_DESCR", "Demonstrates manual link parsing and assembling.<br />Examples: <br />http://yoursite.com/news<br />http://yoursite.com/news/News Title <em>(view news item)</em>");
define("LAN_EURL_NEWS_REWRITEX_LABEL", "Friendly URLs with ID (performance wise)");
define("LAN_EURL_NEWS_REWRITEX_DESCR", "Demonstrates automated link parsing and assembling based on predefined route rules.<br />Examples: <br />http://yoursite.com/news<br />http://yoursite.com/news/1/News Title <em>(view news item)</em>");
//define("LAN_EURL_NEWS_DEFAULT_LABEL", "Default");
//define("LAN_EURL_NEWS_DEFAULT_DESCR", "Legacy direct URLs.");
define("LAN_EURL_NEWS_REWRITEF_LABEL", "Full Friendly URLs (no performance and most friendly)");
define("LAN_EURL_NEWS_REWRITEF_DESCR", "Examples: <br />http://yoursite.com/news/News Category/News Title<em>(view news item)</em><br />http://yoursite.com/news/Category/News Category <em>(list news items)</em>");
define("LAN_EURL_NEWS_REWRITEF_DESCR", "");
define("LAN_EURL_NEWS_REWRITE_LABEL", "Friendly URLs without ID (no performance, more friendly)");
define("LAN_EURL_NEWS_REWRITE_DESCR", "Demonstrates manual link parsing and assembling.");
define("LAN_EURL_NEWS_REWRITEX_LABEL", "Friendly URLs with ID (performance wise)");
define("LAN_EURL_NEWS_REWRITEX_DESCR", "Demonstrates automated link parsing and assembling based on predefined route rules.");
// Downloads
//define("LAN_EURL_CORE_DOWNLOADS", "Downloads");
// Users
define("LAN_EURL_CORE_USER", "Users");
define("LAN_EURL_USER_DEFAULT_LABEL", "Default");
define("LAN_EURL_USER_DEFAULT_DESCR", "Legacy direct URLs. Example: http://yoursite.com/user.php?id.1");
//define("LAN_EURL_USER_DEFAULT_LABEL", "Default");
//define("LAN_EURL_USER_DEFAULT_DESCR", "Legacy direct URLs.");
define("LAN_EURL_USER_REWRITE_LABEL", "Friendly URLs");
define("LAN_EURL_USER_REWRITE_DESCR", "Search engine and user friendly URLs. <br />Example: http://yoursite.com/user/UserDisplayName");
define("LAN_EURL_USER_REWRITE_DESCR", "Search engine and user friendly URLs.");
// Users
define("LAN_EURL_CORE_PAGE", "Custom Pages");
define("LAN_EURL_PAGE_DEFAULT_LABEL", "Default");
define("LAN_EURL_PAGE_DEFAULT_DESCR", "Legacy direct URLs. Example: http://yoursite.com/page.php?1");
//define("LAN_EURL_PAGE_DEFAULT_LABEL", "Default");
//define("LAN_EURL_PAGE_DEFAULT_DESCR", "Legacy direct URLs. ");
define("LAN_EURL_PAGE_SEF_LABEL", "Friendly URLs with ID (performance)");
define("LAN_EURL_PAGE_SEF_DESCR", "Search engine and user friendly URLs. <br />Example: http://yoursite.com/page/1/Page-Name");
define("LAN_EURL_PAGE_SEF_DESCR", "Search engine and user friendly URLs.");
define("LAN_EURL_PAGE_SEFNOID_LABEL", "Friendly URLs without ID (no performance, more friendly)");
define("LAN_EURL_PAGE_SEFNOID_DESCR", "Search engine and user friendly URLs. <br />Example: http://yoursite.com/page/Page-Name");
define("LAN_EURL_PAGE_SEFNOID_DESCR", "Search engine and user friendly URLs.");
// Search
define("LAN_EURL_CORE_SEARCH", "Search");
define("LAN_EURL_SEARCH_DEFAULT_LABEL", "Default Search URL");
define("LAN_EURL_SEARCH_DEFAULT_DESCR", "Legacy direct URL. Example: http://yoursite.com/search.php");
define("LAN_EURL_SEARCH_DEFAULT_DESCR", "Legacy direct URL.");
define("LAN_EURL_SEARCH_REWRITE_LABEL", "Friendly URL");
define("LAN_EURL_SEARCH_REWRITE_DESCR", "Example: http://yoursite.com/search/");
define("LAN_EURL_SEARCH_REWRITE_DESCR", "");
// System
define("LAN_EURL_CORE_SYSTEM", "System");
define("LAN_EURL_SYSTEM_DEFAULT_LABEL", "Default System URLs");
define("LAN_EURL_SYSTEM_DEFAULT_DESCR", "URLs for pages like Not Found, Acess denied, etc. Example: http://yoursite.com/?route=system/error/notfound");
define("LAN_EURL_SYSTEM_DEFAULT_DESCR", "URLs for pages like Not Found, Access denied, etc.");
define("LAN_EURL_SYSTEM_REWRITE_LABEL", "Friendly System URLs");
define("LAN_EURL_SYSTEM_REWRITE_DESCR", "URLs for pages like Not Found, Acess denied, etc.<br />Example: http://yoursite.com/system/error404");
define("LAN_EURL_SYSTEM_REWRITE_DESCR", "URLs for pages like Not Found, Access denied, etc.");
// System
define("LAN_EURL_CORE_INDEX", "Front Page");

View File

@ -43,7 +43,8 @@ class plugin_gallery_rewrite_url extends eUrlConfig
'labels' => array(
'name' => 'Gallery', // Module name
'label' => 'Gallery SEF', // Current profile name
'description' => 'SEF URLs enabled. Example: http://mysite.com/gallery/My Gallery Title', //
'description' => 'SEF URLs enabled.',
'examples' => array('{SITEURL}gallery/my-gallery-title'), //
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -39,7 +39,8 @@ class plugin_gallery_url extends eUrlConfig
'labels' => array(
'name' => 'Gallery', // Module name
'label' => 'Gallery default', // Current profile name
'description' => 'SEF URLs disabled. Example: http://mysite.com/gallery/?cat=gallery_1', //
'description' => 'SEF URLs disabled.', //
'examples' => array("{e_PLUGIN_ABS}gallery/?cat=gallery_1")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@ -147,9 +147,10 @@ class plugin_pm_url extends eUrlConfig
e107::plugLan('pm', 'admin_pm', true);
static $admin = array(
'labels' => array(
'name' => ADLAN_PM, // Module name
'label' => ADLAN_PM_URL_DEFAULT_LABEL, // Current profile name
'description' => ADLAN_PM_URL_DEFAULT_DESCR, //
'name' => LAN_PLUGIN_PM_NAME, // Module name
'label' => LAN_PLUGIN_PM_URL_DEFAULT_LABEL, // Current profile name
'description' => LAN_PLUGIN_PM_URL_DEFAULT_DESCR, //
'examples' => array("{e_PLUGIN_ABS}pm/pm.php")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity