Assigning tags for uploaded HTML files in Concrete5 - html

We are planning to load a number of HTML files as they are in the site using Concrete5.
We had to do this since the number of files is too big to load them via editor.
(We are going to generate the html files with madcap flare)
However, I need to use the tag feature of concrete5 for the contents loaded by this method.
I am told by my developers that this is impossible.
Does anyone know how to use tags for files loaded without going through the C5 editor?
i.e. I want the contents in the manually linked html files to be searched and filtered within the site with the search feature and filter feature provided by C5
HELP!!

I recommend creating a very simple template consisting of the standard C5 header/footer code, with one big block as the contents of the body tag.
You can then import the pages by something along the lines of (pseudo-code):
$parent = Page::getByCollectionPath('/');
$ct = CollectionType::getByHandle('template_name');
$data = array(
'cName' => 'The page title',
'cHandle' => 'The trailing path component'
);
$page = $parent->add($ct, $data);
$blocks = $page->getBlocks('Main');
// Gross hack because the template has one block, and that a 'content' block
$blocks[0]->update('content', 'IMPORTED HTML BODY CONTENT');
After that, you can add tags either via the API or the Dashboard.

Related

Add CodeMirror to a MediaWiki page

I know how to implement CodeMirror to a regular page but I have no idea how to do it on a MediaWiki webpage. I've tried adding the "codemirror.js" file the same way I added other scripts that I am using on the page but I get the error that "CodeMirror" is not defined when it is being initialized. In the code below shows how I added my previous scripts and the "codemirror.js".
$wgResourceModules['ext.SpecialRobotExp'] = array('scripts' => array(
'module/PID.js', 'module/grid.js', 'module/saveFile.js', 'module/codemirror.js'
),
What I need is to know where to save the codemirror.js file and how to load it to the page on a MediaWiki webpage.

retrieving URLs from functions within HTML (python)

I need to scrape some URLs from some retailer product pages, but the specific URLs I need to get aren't in the html part of the page. The html looks like this for each of the items on which one would click to get to the page with the URL I need to grab:
<div id="name" class="hand bold" onclick="AVON.productcontrol.Go(45714);">ADVANCE TECHNIQUES Color Protection Conditioner Bonus Size</div>
I wrote the following to get URLs from the page, but since the actual URLs I need don’t seem to be stored in the page, it doesn’t get what I need:
def getUrls(URL):
"""input: product page url
output: list of urls to products
"""
connection = urllib.urlopen(URL)
dom = lxml.html.fromstring(connection.read())
selAnchor = CSSSelector('a')
foundElements = selAnchor(dom)
urlList = [e.get('href') for e in foundElements]
return urlList
Is there a way to get the link that the function after ‘onclick’ (I guess AVON.productcontrol.Go(#);) takes you to? I don’t fully understand html, and while I’ve read a bit about onclick, I can’t figure out how the function after 'onclick' works.
In order to find the URL that you are taken to on click, you need to find the JavaScript source code of the 'Go' function and read and understand it. It's buried somewhere within a tag or some JavaScript .js file that is referenced directly or indirectly by the HTML page. Happy digging!
Or: you automate the interaction with the web page with a tool like Selenium (http://docs.seleniumhq.org/) and just check where it takes you if you click.

Perl Catalyst - Page not found when using href to link to page on the same site

I am creating a Catalyst application, currently I have a simple login page that also contains a 'Forgotten Password' link. It is all working perfectly, except when I click the 'Forgotten Password' link it should take me to a brand new html page that simply contains the words "Unlucky, you should have remembered it". Instead I get a 'Page not found' error.
What I am doing:
I have a Controller called Login.pm containing the following:
sub default : Private {
my ( $self, $c ) = #_;
$c->forward('login');
}
sub login : Path('/login') {
my ( $self, $c ) = #_;
$c->stash->{title} = "Login page";
$c->stash->{page} = "html";
$c->stash->{template} = "login.html";
}
All of the above works correctly and produces the login page.
In the Catalyst root/login.html file (along with all the other bits like buttons) I have the following piece of code that should allow me to link to the 'Forgotten Password' html page.
<p>Forgot Password?</p>
The root/forgotpassword.html file it is referencing contains the following:
<!DOCTYPE html>
<html>
<body>
<h1>Unlucky, you should have remembered it</h1>
</body>
</html>
However, when I click the 'Forgotten Password' link on the login page it goes to 'mydomainname/forgotpassword.html' and says 'Page not found'.
Do I need to create a Controller for the forgotpassword page? and if so what would it need to contain? Or is there something obvious I am overlooking?
I am new to Catalyst.
Finally worked out the issue, thanks to 'mikew' for referring me to the 'Serving static content' section of the cookbook on CPAN.
What the problem was:
Using the html5 code below I was referencing a simple html page that required no interaction with Catalyst to work.
<p>Forgot Password?</p>
However, as mentioned in the Cookbook and Catalyst::Plugin::Static::Simple
"By default, the following extensions are not served (that is, they will be processed by Catalyst): tmpl, tt, tt2, html, xhtml."
and
"There are some file types you may not wish to serve as static files. Most important in this category are your raw template files. By default, files with the extensions tmpl, tt, tt2, html, and xhtml will be ignored by Static::Simple in the interest of security."
To prevent the 'Page not found' error (as the html page is ignored by default) you need to do add the following to the MyApp.pm file ensuring that you remove the extension/s you do not want to be ignored (in my case html files).
MyApp->config(
static => {
ignore_extensions => [
qw/tmpl tt tt2 xhtml/
],
},
);
I believe what you want to do is make sure that file is served up statically. Look at the cookbook for making sure you are configured to serve up static files instead of sending that request through catalyst.

Embed DWG file in HTML

I want to ask how to embed DWG file in HTML Page.
I have tried using tag with Volo Viewer but this solution run only in IE not in Firefox and Chrome.
Dwgview-x can do that, but it will need to be installed as a plug-in on client computers so that anyone can view the dwg file that you embed online.
There may be third party ActiveX controls that you could use, but I think ultimately you will find that it's not practical for drawing files of even average complexity. I recommend to create DWF (if you need vector format) or PNG files on demand (using e.g. the free DWG TrueView from http://usa.autodesk.com/design-review/ ) and embed those instead.
I use DWG Browser. Its a stand alone program that is used for reporting and categorizing drawings with previews. It saves exports in html too.
They have a free demo download available.
http://www.graytechnical.com/software/dwg-browser/
You'll find what I think is the latest information on Autodesk's labs site here: http://labs.blogs.com/its_alive_in_the_lab/2014/01/share-your-autodesk-360-designs-on-company-web-sites.html
It looks like a DWG can be embeded there is an example on this page, but clearly DWF is the way to go.
You can embed DWG file's content in an HTML page by rendering the file's pages as HTML pages or images. If you find it an attractive solution then you can do it using GroupDocs.Viewer API that allows you to render the document pages as HTML pages, images, or a PDF document as a whole. You can then include the rendered HTML/image pages or whole PDF document in your HTML page.
Using C#
ViewerConfig config = new ViewerConfig();
config.StoragePath = "D:\\storage\\";
// Create HTML handler (or ViewerImageHandler for rendering document as image)
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
// Guid implies that unique document name
string guid = "sample.dwg";
// Get document pages in html form
List<PageHtml> pages = htmlHandler.GetPages(guid);
// Or Get document pages in image form using image handler
//List<PageImage> pages = imageHandler.GetPages(guid);
foreach (PageHtml page in pages)
{
// Get HTML content of each page using page.HtmlContent
}
Using Java
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
// Set storage path
config.setStoragePath("D:\\storage\\");
// Create HTML handler (or ViewerImageHandler for rendering document as image)
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
String guid = "Sample.dwg"
// Get document pages in HTML form
List<PageHtml> pages = htmlHandler.getPages(guid);
for (PageHtml page : pages) {
// Get HTML content of each page using page.getHtmlContent
}
Disclosure: I work as a Developer Evangelist at GroupDocs.

Wrap MediaWiki in another website

I want to wrap a mediawiki site inside another site - using the header.inc and footer.inc files that the rest of the website's html files use.
I'm not familiar with php, is there a 'masterpage' file somewhere I can put them in?
Your best bet would be to create a custom skin, or edit one of the default skins, such as monobook. They control most of the basic presentation code. Here is one short tutorial on creating a custom skin. The files usually live in the /skins/ folder; if you skim through one, you can find where the HTML begins and ends.
You can include another file using the PHP include function, like so:
<html>
...
<body>
<?php
include 'header.inc';
?>
...
For future reference in the LocalSettings.php you can also prevent users from using any other skin.
$wgDefaultSkin = 'myskin';
$wgAllowUserSkin = false;
$wgSkipSkins = array( "chick", "cologneblue", "monobook", "modern", "myskin", "nostalgia", "simple", "standard" );