How to add folders in the main folder in webscripts - alfresco

i need your help, I have created in Share a new type folder, called "TanFolder". it's on documentLibrary. I would like, when i create this folder, three other folders will be created automatically within it
Example: every time i create a TanFolder three folders will be automatically created in this tanFolder
the problem is that, I do not know where I need to make code changes
thank you

Several approaches are possible. It depends on the use case.
You can use space templates. These are defined in Data dictionary/Space templates and can be added in any site using the Create button in the toolbar. Just create a folderstructure once inside the space templates folder and you can reuse it every time. No code changes needed.
Or you can create a custom Rule for your new content type which executes a javascript that creates the subfolders every time a new TanFolder is created. Would require just a small javascript. The rest is condiguration.
A third approach is to use Alfresco Behaviours. This requires some java code and a bean declaration. If you are starting with Alfresco I would try the first two approaches first.

Related

Modification to published magnolia components

Let suppose that in Magnolia's Page application you have few pages with instances of component "A" which have property dialog. These pages are published to Public server.
later you decide to change structure of this properties (add fields or for example change image field to array of images)
to do so you would modify component's dialog yaml file (add/modify fields) and component's template ftl file to render these changes
Question: - will this destroy previously created pages with instances of component "A"? i.e. if you need to modify component's properties it's better to create new component instead of modify existing?
It's fine to modify existing component, as long as you take care of the fact that existing instances will not have any values for newly added properties/fields. So in template you need to expect that you might get empty values and provide good defaults to cover that case. So technically, you can modify the component just fine.
Whether it is better to create new component or modify existing one depends more on the business needs. Is it desired pages to see new component look & get new fields in pages that already use the component or are those changes relevant just for new pages in which component will be used?
Another consideration is the more components you have, the harder it would be for editor to pick the right one from the ever growing list. However the more functionality you cram into single component, the more complex and difficult to test it would become and harder it would be to replace it with something else in the future.

how does common metadata fields from content alfresco work?

I created with the help of model manager a custom type for my folders and all I want is to have some sort of popup window to fill all the properties and then spread to all the files inside that folder, Is there any relation with the rules of folders and common metadata fields from content? Any help would be apreciated thx
If you configured a form along with your custom model, you should already have a way to edit the custom metadata on your folders.
If you also want that same metadata on your content, then hopefully you implemented your custom metadata on an aspect. The aspect can be applied to folder instances as well as content instances.
Once you have an aspect applied to the folder and content instances, it sounds like the next thing you want to do is copy metadata values from the folder to the content. There is nothing out-of-the-box that will do this for you. You can do this with a rule.
I suggest reading the documentation on the Alfresco server-side JavaScript API and also installing the Alfresco JavaScript Console add-on. You can create a server-side JavaScript file that will reside in Data Dictionary/Scripts. Then you can set up a rule on your folder to invoke that JavaScript to copy metadata from the folder to the documents when the documents are created.
Keep in mind that if the metadata on the folder changes you will have write a rule to deal with that if you want to copy the updated values to the content instances in the folder. This could get very expensive if the folder grows in size.

How does Drupal add module css files to the consolidated file when flushing my theme cache?

When I clear my theme registry Drupal runs off and builds out a nice consolidated css file, but it does this for different node/page types so that I get several instances of said file existing. I mentioned this in another question I asked (and answered), but my question is, how does Drupal deduce what css files it needs to add to the consolidated version? There must be numerous different places that control what modules appear on a particular node, so what constitutes a rule for another css file being built?
Well that wasn't an easy chain of functions to follow but I think I've got there...
Every time a page is 'refreshed' (i.e. built from scratch, not served from cache) all CSS files added with drupal_add_css() during that page build are aggregated and saved to a single file that is returned as the <link> tag for that page.
The following line in drupal_add_css() decides what the aggregated CSS file's name will be:
$filename = 'css_'. md5(serialize($types) . $query_string) .'.css';
$types in this context is an array of all of the CSS files added using drupal_add_css() during the current page build. The filename for the aggregated CSS contains a serialised string of $types, which essentially means that any other page that adds the same CSS files as that one will receive exactly the same file name and thus load the same CSS file.
So basically, the aggregation function is run for every single page build so all CSS added to that page will be aggregated every time. If certain pages happen to use the same modules then they will automatically be served the same CSS file as defined in the PHP snippet above. When you combine that with page caching you get the results you find in the HTML source on the different pages.
Hope that makes sense!

Storing stylesheets for a website in MVC architecture

I am building up a website using MVC architecture. It takes a lot of css with it. I require atleast 20 css files to store within it each associated with some unique views. I want to know where can I store the css files? Either in a single root css directory or shall I store it with a particular view. Also linking these files within the common template file would be tedious enough. I mean it would show up 20 different tags. Is there any alternative way to do this? Please help. I am using codeigniter framework by the way.
What I do is store it all in a css folder inside the public folder (the one that houses your index.php file). I also have a helper method that generates the actual link tags, so in the template files, I just have something like:
<?= stylesheet('sheet1','sheet2','sheet3') ?>
The helper method that calls would then make the links (and assumes that they're in the public/css directory).
That cleans up the raw template files, though it does still make multiple tags in the files themselves. I use partial views, so there's a master view that has the main CSS file(s) that are used on every page (or almost every page), then add in on each template the ones that are unique to the view.
If you have 20 CSS files, you might want to go through and see what you can tidy up and make more generic. Any place where you have more than one of the same styles (even across files) is up for the chopping block. Any extra files should be relatively small and provide only overrides for the exception pages (and if you can genericize those more, so you use a file for more than one page, then that's even better).
I would recommend you to combine all the CSS files in a single file. Its easier to maintain and you will have only one request to the server. Having so many css files will only increase the loading time of your page. Also gzip the css files to increase the page speed.

Drupal - General means for finding templates?

Given that I have a URL to a page and I can see the content on it as a user, is there a simple way to find out what template files are producing the page? Ideally I would like to know three things:
The current template file(s) being used
The filename(s) I can create in the local folder to customize them
What variables are available to these file(s)
I just want to know what the general procedure is for finding this information out.
The devel_themer module includes a theme developer function that'll let you click anywhere in the page and determine what templates, theme functions, etc. are used (or can be used) to generate an element.
You can use PHP's get_defined_vars() function to get the variables available in a particular template or function.

Resources