public static void html_owner_paths(path p, out string styles, out string html, style s = null, bool with_events = true) { styles = s != null ? $@".owner-paths {{ opacity:0.6; margin-bottom:2px; }} .owner-path {{ color:{s.css_clr(s.fc3)}; }} .path-bar {{ font-family:{s.font_family_semibold} !important; color:{s.css_clr(s.fc1)}; }} .path-root {{ font-family:{s.font_family_semibold} !important; font-size:110%; color:{s.css_clr(s.fc1)}; }}" : ""; html = $@"<div class='owner-paths'> {(p.owner_paths.Count > 0 ? string.Join("", p.owner_paths.Select(x => $@"{(x.level == 0 ? "<a class='path-root' href='javascript:open_root()'>\\\\</a>" : "<span class='path-bar'>\\</span>")}<a class='owner-path'{(with_events ? $" href='javascript:open_path({x.id})'" : "")}>{x.title}</a>")) : $"<a class='path-root'{(with_events ? " href='javascript:open_root()'" : "")}>\\\\</a>")} </div>"; }
public static string base_styles(style s, bool light = false) { string m = light ? "0pt" : "2pt"; return($@"html {{ padding: {m}; margin: {m}; }} body {{ font-family:{s.font_family_light} !important; background-color: {s.css_clr(s.back_color_page)}; color:{s.css_clr(s.fore_color)}; font-size:{s.fs2}pt !important; padding:{m}; margin:{m}; }} .f-sb {{ font-family:{s.font_family_semibold} !important; }} .f-l {{ font-family:{s.font_family_light} !important; }} .fc-1 {{ color: {s.css_clr(s.fc1)} !important; }} .fc-2 {{ color: {s.css_clr(s.fc2)} !important; }} .fc-3 {{ color: {s.css_clr(s.fc3)} !important; }} .fc-4 {{ color: {s.css_clr(s.fc4)} !important; }} .link {{ color:{s.css_clr(s.fore_color_link)} !important; }} .cancel-link {{ color:{s.css_clr(s.fore_color_cancel_link)} !important; }} .light {{ color:{s.css_clr(s.fore_color_light)} !important; }} .light2 {{ color:{s.css_clr(s.fore_color_light2)} !important; }} .error {{ color:{s.css_clr(s.fore_color_error)} !important; }} .warning {{ color:{s.css_clr(s.fore_color_warning)} !important; }} .tltp {{ font-family:{s.font_family_semibold}; color:white; font-size:{s.font_size_normal - 2}pt !important; background-color:{s.css_clr(s.bc_tooltip2)} !important; margin:4px !important; }}"); }
protected override void load_objects(object data = null) { base.load_objects(data); this.path = (path)data; style s = main.style; add_script($@"function del_path(id_path) {{ fnc('del-path', id_path); }} function open_path(id_path) {{ fnc('open-path', id_path); }} function open_root() {{ fnc('open-root'); }} function change_title(el) {{ fnc('change-title', [$(el).text()]); }}"); // owner path html_owner_paths(this.path, out string styles, out string html, s); add_styles(styles); add_html(html); // title add_style(".title", "font-size:200%; display:block;"); add_html(html_title()); // sub paths add_style(".sub-paths", "opacity:0.4; margin-top:0px;"); add_style(".sub-path", $"color: {s.css_clr(s.fc3)}; margin-right:10px;"); if (this.path.sub_paths.Count > 0) { add_html($@"<div class='sub-paths'> {string.Join("", this.path.sub_paths.Select(x => $"<a class='sub-path' href='javascript:open_path({x.id})'>\\{x.title}</a>"))}</div>"); } add_html("<br/>"); // tags add_html($@"<div web-element='tags' class='row{(this.path.tags.Count == 0 ? " hide" : "")}'><div class='col-sm-2 mt-3 op-6'>tags</div> <div class='col-sm-10 mt-3' web-element='tags-eles'>"); add_elements(this.path.tags.Select(x => new web_tag(this.path, x))); add_html("</div></div>"); // keys add_script($@"function sh_keys(el, sh){{ var a = []; $(el).parent().parent().find('[id-element]').each(function(i) {{ a[i] = $(this).attr('id-element'); }}); if(fnc(sh ? 'show-keys' : 'hide-keys', a)) {{ $('#s-keys,#h-keys').removeClass('hide'); if(!sh) {{ $('#s-keys').show(); $('#h-keys').hide(); }} else {{ $('#s-keys').hide(); $('#h-keys').show(); }} }} }}"); bool show_pwd = logged.utente().show_keys_pwds; add_html($@"<div web-element='keys' class='row{(this.path.keys.Count == 0 ? " hide" : "")}'><div class='col-sm-2 mt-3 op-6'>keys <img id='s-keys' class='f-r op-6 hand{(show_pwd ? " hide" : "")}' data-toggle='tooltip' title='visualizza le password...' onclick='sh_keys(this, true)' src='{img_src("eye", img_size.img_24)}'/> <img id='h-keys' class='f-r op-6 hand{(!show_pwd ? " hide" : "")}' data-toggle='tooltip' title='nascondi le password...' onclick='sh_keys(this, false)' src='{img_src("invisible", img_size.img_24)}'/></div> <div class='col-sm-10 mt-3' web-element='keys-eles'>"); add_elements(this.path.keys.Select(x => new web_key(this.path, x))); add_html("</div></div>"); // links add_html($@"<div web-element='links' class='row{(this.path.links.Count == 0 ? " hide" : "")}'><div class='col-sm-2 mt-3 op-6'>links</div> <div class='col-sm-10 mt-3' web-element='links-eles'>"); add_elements(this.path.links.Select(x => new web_link(this.path, x))); add_html("</div></div>"); // values add_html($@"<div web-element='vals' class='row{(this.path.values.Count == 0 ? " hide" : "")}'><div class='col-sm-2 mt-3 op-6'>values</div> <div class='col-sm-10 mt-3' web-element='vals-eles'>"); add_elements(this.path.values.Select(x => new web_value(this.path, x))); add_html("</div></div>"); }