Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

So I have been able to figure out in Alfresco, there is a form called skin.css that allows me to change the highlighted color of data table items. However, I only want to be able to change this property during the course of a workflow and not as it applies to all data list elements throughout the entire Share website.

To start, I have a script which kicks off based on a rule and moves any updated/new files into a specified folder and then kicks off a workflow for that file. Within starting the workflow, the package items list is populated with all the documents within the same folder as the document that just got moved/the workflow started on. Below is the script:

function main()
{
    var counter=0;
    //Administrative Adjudication space/folder MUST exist under companyhome.
    var rootSpaceName = companyhome.childByNamePath("mainFolder");

    //If the rootspacename is null (not previously created), then exit the program as we have nothing to do.
    if(rootSpaceName == null)
    {
        logger.log("Company Home/mainFolder does not exist, so we have nothing to do.");
        return;
    }
    else
    {
        logger.log("Company Home/mainFolder exists, so carry on our process.");
        //Creates an array of all the children under the rootSpaceName
        var childList = rootSpaceName.children;
        //Creates a variable which counts the number of children in the childList array
        var count = childList.length;
        //var seconds = new Date().getTime() / 1000;

        //If there are no children in the rootSpaceName folder, exit the program.
        if(count == 0)
        {
            logger.log("Company Home/mainFolder does not have child, nothing to do.");
            return;
        }
        else
        {
            for(var i = 0; i < count; i++)
            {
                //Title MUST exist.
                var childTitle = childList[i].properties["hearing:childTitle"];
                //Author MUST exist.
                var childAuthor = childList[i].properties["hearing:childAuthor"];
                logger.log("childTitle: " + childTitle);
                logger.log("childAuthor: " + childAuthor);

                if(childTitle == null || childAuthor == null)
                {
                    logger.log(i + ". Both the childTitle and childAuthor are null...");
                    continue;                             
                }

                var child = childList[i];

                if(child.isContainer == false)
                {
                    for(var j = 0; j < count; j++)
                    {
                        var newChildName = childList[j].properties.name;
                        logger.log("New child name: " + newChildName);
                        var newChild = childList[j];

                        if((newChild.isContainer == true) && (childTitle == newChildName))
                        {
                            logger.log("There is a currently existing folder with the same name as the title of original child");
                            var newSpaceName = rootSpaceName.childByNamePath(newChildName);
                            var newChildList = newSpaceName.children;
                            var newCount = newChildList.length;

                            for(var k = 0; k < newCount; k++)
                            {
                                var newNewChildName = newChildList[k].properties.name;
                                var newNewchildAuthor = newChildList[k].properties.author;
                                var newNewChild = newChildList[k];

                                if((newNewChild.isContainer == true) && (newNewchildAuthor == childAuthor))
                                {
                                    var currentSpace = newSpaceName.childByNamePath(newNewChildName);                                  

                                    if(child.isDocument == true)
                                    {
                                        //Only want the workflow to run once so we increment count
                                        counter=counter+1;
                                        child.move(currentSpace);
                                        //If Count is 1, then run workflow
                                        if(counter==1)
                                        {                   
                                            //starts HelloWorldUI workflow                 
                                            var wfdef=workflow.getDefinitionByName("activiti$helloWorldUI");

                                            if(wfdef)
                                            {
                                                var wfparams=new Array();
                                                wfparams["bpm:workflowDescription"]="";
                                                wfparams["bpm:groupAssignee"]=people.getGroup("GROUP_Managers");

                                                var wfpackage=workflow.createPackage();
                                                var rootSpaceName=currentSpace;
                                                var childList=rootSpaceName.children;
                                                var count=childList.length;

                                                //add all existing documents in the space to the workflow
                                                for(var i = 0; i < count; i++)
                                                {
                                                    wfpackage.addNode(childList[i]);
                                                }

                                                var wfpath=wfdef.startWorkflow(wfpackage,wfparams);
                                                var tasks=wfpath.getTasks();

                                                for each(task in tasks)
                                                {
                                                    task.endTask(null);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        else

                        {
                            // If title folder is already created, not need to create again.
                            var newSpaceName = companyhome.childByNamePath("mainFolder/" + childTitle);

                            if(newSpaceName == null)
                            {
                                newSpaceName = rootSpaceName.createFolder(childTitle);
                                logger.log("mainFolder/" + childTitle + " is created.");
                            }

                            // If author folder is already created, not need to create again.
                            var newNewSpaceName = companyhome.childByNamePath("mainFolder/" + childTitle + "/" + childAuthor);

                            if(newNewSpaceName == null)
                            {
                                newNewSpaceName = newSpaceName.createFolder(childAuthor);
                                logger.log("mainFolder/" + childTitle + "/" + childAuthor + " is created.");
                            }

                            if(child.isDocument == true)
                            {
                                counter=counter + 1;
                                child.move(newNewSpaceName);

                                if(counter == 1)
                                {
                                    var wfdef=workflow.getDefinitionByName("activiti$helloWorldUI");

                                    if(wfdef)
                                    {
                                        var wfparams=new Array();
                                        wfparams["bpm:workflowDescription"]="";
                                        wfparams["bpm:groupAssignee"]=people.getGroup("GROUP_Managers");
                                        var wfpackage=workflow.createPackage();
                                        var rootSpaceName=newNewSpaceName;
                                        var childList=rootSpaceName.children;
                                        var count=childList.length;

                                        //add all items from the space to the workflow
                                        for(var i = 0; i <c ount; i++)
                                        {
                                            wfpackage.addNode(childList[i]);
                                        }   

                                        var wfpath=wfdef.startWorkflow(wfpackage,wfparams);
                                        var tasks=wfpath.getTasks();

                                        for each(task in tasks)
                                        {
                                            task.endTask(null);
                                        }

                                    }
                                }
                                logger.log("Moving file " + child.properties.name);
                            }
                        }
                    }
                }
            }
        }
    }
    return;
}

main();

I would like to be able to create a function of some sort that can be called to access the skin.css file only during the course of the workflow and basically set .yui-skin-default tr.yui-dt-first{background-color:#FFF} in the CSS file. Does anyone know how I would go about doing that?

share|improve this question
1  
Have you considered adding a custom style sheet to your browser? Not sure how one would go about doing this in other browsers, but Opera allows for this by editing some .ini files and has the ability to toggle individual custom style sheets as desired. –  cimmanon Sep 14 '12 at 15:50
    
Well I would prefer to make this applicable to all browsers if that were possible. But yeah, it would be nice if it was as simple as copying the skin.css file to a new CSS file, modifying the one section i need, and toggling between the old and new file within the workflow. –  This 0ne Pr0grammer Sep 14 '12 at 15:53
    
A bookmarklet might be a good option for you then. I've never written one before, so you'll have to do a bit of research on how to do it. –  cimmanon Sep 14 '12 at 16:13

2 Answers 2

up vote 1 down vote accepted

If you want to change only in start workflow page, your css should write in start-workflow.css which is pointed by start-workflow.get.head.ftl. This css will override in other css file like skin.css.

Like this way, you can override any css to affect in only start workflow page not others. You can try for other workflow related pages.

share|improve this answer

I've found a bookmarklet that will allow you to inject a CSS file on any page you'd like. Only down side is that you'll have to run it every time you load your page.

http://allben.net/post/2010/01/30/CSS-JavaScript-Injection-Bookmarklets.aspx

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.