Help with atk4-web, atk4-example ver. 4.03 - atk4

I don't now where can I find help. None forums about atk4.
Can you help me, please?
atk4-web (4.0.3):
How run atk4-web localy, where is site dump (mysql database)?
What is mean this error:
No such tag (version) in template for Object AgileToolkitWeb(agile_project). Tags are: page_title, page_title#1, seo_keywords, seo_keywords#2, seo_descr, seo_descr#3, template, template#4, template#5, template#6, template#7, template#8, template#9, os, os#10, js_include, js_include#11, document_ready, document_ready#12, section, section#13, template#14, menu_about, menu_about#15, page, page#16, menu_doc, menu_doc#17, page#18, menu_develop, menu_develop#19, page#20, menu_services, menu_services#21, page#22, menu_download, menu_download#23, page#24, menu_blog, menu_blog#25, page#26, link_comparison, link_comparison#27, link_example, link_example#28, link_tour, link_tour#29, Content, Content#30, TabContent, TabContent#40
D:\Www\atk4web\atk4\lib\SMlite.php:341
atk4-example (4.0.3):
Why page has not javascrip included, when I allow ->check() in Frontend?
What is difference between empty.html and shared.html?
empty.html:
shared.html:
Why I got error when I did change in empty.html to:
Thanks.

Agile Toolkit uses template engine called 'SMlite'. Its very basic and allows you to load template, then set tags to a certain value.
$tpl->trySet('mytag',123);
Views in Agile Toolkit rely on this template engine and will try to generate their output and place inside parent's template. In your case object was instructed to use spot which did not exist in the template.
Read section about adding here: http://agiletoolkit.org/doc/learn, it should be helpful.
There are no need for JavaScript on auth login form. It also bypasses some of the UI/functionality due to security reasons. You can either create your own empty.html by placing it into template/jui/empty.html (without atk4) and enable javascript in there.
Also sequence of adding jUI and executing auth->check() might change this, but I'm not sure.

Related

Cannot Browse to specific Type in Settings designer for WPF/.net Core application

When I've used Settings Designer before, I've been able to browse to find non-standard Types (e.g. uncommon enums etc) to use in my Settings via a "Browse" button at the bottom of the drop down under the "Type" column. I'm developing a WPF desktop application for .net Core and there is no Browse option as pictured below:
I did go into the code behind (Settings.Designer.cs.) and edit the code manually, but on saving, this just reverted to string. I'm guessing this may have something to do with settings also having an element in App.config and I notice it has a "serialiseAs" tag - didn't know what to put here. Exmaple of the code behind settings and App.config:
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string UiTheme {
get {
return ((string)(this["UiTheme"]));
}
set {
this["UiTheme"] = value;
}
}
<userSettings>
<GameBoxer.WPF.Properties.Settings>
<setting name="UiTheme" serializeAs="String">
<value />
</setting>
</GameBoxer.WPF.Properties.Settings>
</userSettings>
Does anyone know how to bring back the 'Browse'?? Or, how to correctly do it in code?
I'm using Visual Studio 2022 Community
Thanks
UPDATE: So, I learn that this is "By Design" in VS2022 according to MS here. It's still present in VS2019! But they've taken it out of VS2022 and I can't figure how to do it in code. MS, you're one of my faves out the bunch, but sometimes, you're as mad as a box of frogs. unfortunately that link doesn't provide the poster with any alternatives other than "that's not a bug." Not very helpful, really.
As mentioned in the link you provided, this change was by design due to .NET Core and while I very strongly disagree with their stance on this - I'm assuming this was done because it could be quite fiddly to get your own types to work as expected, especially for new users.
One simple workaround if your custom data has several values, you can use string and simply write your own little parser using delimiters such as ;. You could also use StringCollection to achieve the same result.
Inconvenient, yes. But a simple solution nonetheless.
I sincerely hope Microsoft changes their stance on this and looks at reimplementing this as it worked remarkably well once you figured out the procedure to get it to serialize properly.
Edit:
Figured I might as well provide an example;
// Storing the Settings
// Parameter: Struct { Location(Point), Size(Point), Margin(Thickness) }
var settingString = $"{e.Location.X};{e.Location.Y};{e.Size.X};{e.Size.Y};{e.Margin.Left};{e.Margin.Top};{e.Margin.Right};{e.Margin.Bottom}";
Properties.Settings.Default.MySetting = settingString;
Properties.Settings.Default.Save();
// Parsing the Saved Setting
var settingString = Properties.Settings.Default.MySetting;
if (!String.IsNullOrWhiteSpace(settingString))
{
List<string> splitStrings = settingString.Split(';', StringSplitOptions.RemoveEmptyEntries).ToList();
List<double> parsedValues = new List<double>();
splitStrings.ForEach(x => parsedValues.Add(double.Parse(x)));
var location = new Point(parsedValues[0], parsedValues[1]);
var size = new Point(parsedValues[2], parsedValues[3]);
var margin = new Thickness(parsedValues[4], parsedValues[5], parsedValues[6], parsedValues[7]);
}
There's probably better ways of doing this, but I find this to be a very simple workaround and has worked great thus far.

jqGrid - sorting won't work when datatype:local (jsFiddle included)

I couldn't find any solution.
I want to load my data from a local array. When I use the same settings in a different grid with datatype:json, from server, everything works fine.
But here I need a local array, I use data option. array is in format:
[[x,y,z], ...]
JSFIDDLE:
http://jsfiddle.net/7osga648/
CODE:
$("#datagrid1").jqGrid({
datatype:'local',height:350,width:400,gridview:true,rownumbers:true,rowNum:1000,viewrecords:true,
colNames:["time","col1","col2"],
colModel:[
{name:'time',width:150,resizable:false,sorttype:'date',datefmt:"d/m/Y H:i:s"},
{name:'f1',width:100,resizable:false,sorttype:'number'},
{name:'f2',width:100,resizable:false,sorttype:'number'}],
data:[["03/10/2014 20:46:27","60.8","2.5"],["03/10/2014 21:01:39","58.3","0.1"],["03/10/2014 21:16:51","61.3","3.4"],["03/10/2014 21:32:05","58.9","0.6"],["03/10/2014 21:47:18","58.7","0.8"],["03/10/2014 22:02:32","58.2","0.0"],["03/10/2014 22:17:45","61.9","3.8"],["03/10/2014 22:32:58","58.4","0.1"],["03/10/2014 22:48:11","60.0","2.1"],["03/10/2014 23:03:22","61.2","3.4"],["03/10/2014 23:18:34","62.0","3.8"],["03/10/2014 23:33:47","58.6","0.2"],["03/10/2014 23:49:00","58.4","0.2"],["04/10/2014 00:04:14","58.1","0.2"],["04/10/2014 00:19:28","58.1","0.2"],["04/10/2014 00:34:40","61.8","3.9"],["04/10/2014 00:49:51","58.9","0.6"],["04/10/2014 01:05:03","58.2","0.1"],["04/10/2014 01:20:16","61.2","3.4"],["04/10/2014 01:35:28","59.2","0.9"],["04/10/2014 01:50:40","58.4","0.1"],["04/10/2014 02:00:04","0","0"],["04/10/2014 02:05:52","61.8","3.7"],["04/10/2014 02:21:04","62.9","3.7"],["04/10/2014 02:36:15","63.1","3.5"],["04/10/2014 02:51:27","63.7","3.5"],["04/10/2014 03:06:40","60.1","0.0"],["04/10/2014 03:21:53","63.1","3.1"]],
localReader:{repeatitems:true,cell:""},
caption:"sorting not working. click on col header"
});
Try to click on column header, and see that nothing is happening.
Any idea?
I posted already the bug fix here. The modified demo "jsfiddle.net/7osga648/4/" uses directly the new features. See the answer for additional information.

How do you check in code if a request matches an EPiServer Visitor Group

We've set up a new "visitor group" in EPiServer 6r2, and we want to add a css class to the <body> tag of the site if the user is in that group, so different groups get different site designs. I'm trying to find out if the current visitor is in a matching group in the code-behind of a masterpage file in order to add this extra class and can't get the below code to return anything but false.
I'm not sure if the role name mentioned is the name you enter in the CMS UI when adding a visitor group.
Paul Smith blogged a proposed solution to this but I haven't been able to get it to return anything but false yet, and judging by the only comment on the blog article I'm not alone. Code sample #1 from this link (which is the one I'm using):
using EPiServer.Personalization.VisitorGroups;
...
bool match = EPiServer.Security.PrincipalInfo.CurrentPrincipal
.IsInRole("My Visitor Group", SecurityEntityType.VisitorGroup);
I found the developer guide to membership and role providers which states that replacePrincipal must be set to true for the correct principal to be in place. I checked and this is already the case for my config.
Documentation
EPiServer 7 doc
IPrincipal.IsInRole() extension
SecurityEntityType enum
Oddly I searched the 6r2 documentation from http://sdk.episerver.com/ and can't find the documentation for IPrincipalExtensions at all, even though I see the class in object browser in 6.2. in my sln. Details: Assembly EPiServer.ApplicationModules - C:\Windows\assembly\GAC_MSIL\EPiServer.ApplicationModules\6.2.267.1__8fe83dea738b45b7\EPiServer.ApplicationModules.dll - public static bool IsInRole(this System.Security.Principal.IPrincipal principal, string role, EPiServer.Security.SecurityEntityType type)
Member of EPiServer.Personalization.VisitorGroups.IPrinicipalExtensions
Please comment if you spot errors or I've missed anything as coding for EPiServer is a bit of a fog-of-war affair and I'm a little battle-weary.
Found it by browsing the object model and guessing. So much for documentation.
using EPiServer.Personalization.VisitorGroups;
using EPiServer.Security;
const string visitorGroupName = "Some users";
var groupHelper = new VisitorGroupHelper();
bool isPrincipalInGroup = groupHelper.IsPrincipalInGroup(
PrincipalInfo.CurrentPrincipal, visitorGroupName);
Tested and working in EPiServer 6r2 (aka 6.1).
String visitorGroupName must match the string entered into the "Name" box on the EPiServer admin interface when creating / editing the visitor group. See screenshot below:

Trouble using dbforge with PyroCMS (CI based CMS)

I have been using PyroCMS and CI for quite some time, and truly love it.
I am extending a DB module that will allow an admin user to manage a DB without having to use something like phpMyAdmin.
The only thing I have been able to get working however is Browsing a table's field values (i.e 'SELECT * FROM 'table_name').
I want to include more functions, but I can't seem to get dbforge to work properly. I know it is loaded because dbforge is used to uninstall modules. I also get no error when calling functions from it.
Here is an example of my code from the controller (dbforge has already been loaded).
public function drop($table_name)
{
$table_name = $this->uri->segment(4);
$this->dbforge->drop_table($table_name);
redirect('admin/database/tables');
}
Lets say the function gets called from this url:
.../admin/database/drop/table_name
It appears to work... but instead it just redirects to the tables overview.
Is there something I am missing? Shouldn't [$this->dbforge->drop_table($table_name);] always drop a table (given $table_name is valid)?
EDIT
As a work around, I was able to use:
public function drop($table_name)
{
$table_name = $this->uri->segment(4);
//$this->dbforge->drop_table($table_name);
$this->db->query("DROP TABLE ".$table_name);
redirect('admin/database/tables');
return TRUE;
}
I really would like to use DB forge, however...
I think you might be getting a little confused by the site prefixes in PyroCMS 1.3.x.
By default all installations of Community and Professional will have default_ as a prefix for all tables in the first site. If you have Professional you can add new sites and the site reference will be whatever_ instead of default_
This prefix is accounted for by dbforge, so when you want to delete default_blog you would just delete:
/admin/database/drop/blog
Also, why are you accepting the $table_name as an argument then overriding it with a uri segment?
Also, why are you accepting the $table_name as an argument then overriding it with a uri segment?
See what I did there? xD
public function drop($table_name)
{
$this->dbforge->drop_table($table_name);
redirect('admin/database/tables');
}

How can I fix the unsecure_base_url on my Magento installation?

I've been having problems with uploading images and in trying to fix it, happened to change the base_url in the config which has now caused my website to appear without any styling at all (inc the Admin).
I've gone into phpMyAdmin and fixed the urls but i'm not having any luck. This is what i've got at the moment...
web/unsecure/base_link_url http://www.northwalesdoorworld.co.uk/
web/unsecure/base_skin_url http://www.northwalesdoorworld.co.uk/skin/
web/unsecure/base_media_url http://www.northwalesdoorworld.co.uk/media/
web/unsecure/base_js_url http://www.northwalesdoorworld.co.uk/js/
Could someone please take a look at my site - northwalesdoorworld.co.uk - and recommend a way to solve my problem?
thanks,
Greg.
if you can't access your site due that you can change the values directly in core_config_data table
SELECT * FROM core_config_data WHERE path LIKE '%web/unsecure%' or path LIKE '%web/secure%'
you can fix them by editing the values to be like clockworkgeek suggested or removing whole rows from database and they will be created over again by magneto and you can use the admin page to add new values.
Change the four values to:
{{unsecure_base_url}}
{{unsecure_base_url}}skin/
{{unsecure_base_url}}media/
{{unsecure_base_url}}js/
Empty var/cache/ in your magento folder.
Please refer to the most recent Magento wiki entry: http://www.magentocommerce.com/wiki/recover/restore_base_url_settings
You can also add something like this to /MAGENTO/app/etc/config.xml rather than manipulate the database:
<stores>
<default>
<web>
<unsecure>
<base_url>{{base_url}}</base_url>
<base_link_url>{{unsecure_base_url}}</base_link_url>
<base_web_url>{{unsecure_base_url}}</base_web_url>
<base_skin_url>{{unsecure_base_url}}skin/</base_skin_url>
<base_js_url>{{unsecure_base_url}}js/</base_js_url>
<base_media_url>{{unsecure_base_url}}media/</base_media_url>
</unsecure>
<secure>
<base_url>{{base_url}}</base_url>
<base_web_url>{{secure_base_url}}</base_web_url>
<base_link_url>{{secure_base_url}}</base_link_url>
<base_js_url>{{secure_base_url}}js/</base_js_url>
<base_skin_url>{{secure_base_url}}skin/</base_skin_url>
<base_media_url>{{secure_base_url}}media/</base_media_url>
</secure>
</web>
</default>
</stores>

Resources